Memory RAM address of a variable in Lua

2019-09-21 00:15发布

How to access in C++, the memory address of a variable declared in the language Lua???

in other words (example in written Lua):

X = 10

How to access the memory address of the variable X, which was declared on the Lua?

address = (&X) ?????????

Help me please!!

1条回答
贪生不怕死
2楼-- · 2019-09-21 00:57

You don't, you ask the Lua API for the value of the variable, or set it.

use :-

  • lua_getfield
  • lua_setfield

refer...

http://www.lua.org/manual/5.1/manual.html

for a description and examples.

查看更多
登录 后发表回答