Memory RAM address of a variable in Lua

拥有回忆 提交于 2019-12-12 06:46:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!