🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Lua Stack, luabind and object parameter

Started by
0 comments, last by quasty 20 years, 2 months ago
Hi, can I rely that if I call a script using lua_dofile with is introducing a function test() this functions stays accessible till the stack/VM is closed? I''m thinking of a way to call a certain lua function from c++ and passing an object-reference/pointer. But this pointer differs during runtime so I''ve to pass it directly somehow as a parameter from C++ to lua. Any idea how do it? thank you
Advertisement
lua_dofile loads the specified file as one big function and executes it. If that function contains global function declarations (which it sounds like it does) those will therefore be executed. The global variables that are set will stick around until you assign them to something else. So you can use lua_getglobal to access them.

"Sneftel is correct, if rather vulgar." --Flarelocke

This topic is closed to new replies.

Advertisement