问题
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:
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.
来源:https://stackoverflow.com/questions/8980317/memory-ram-address-of-a-variable-in-lua