¡@

Home 

c++ Programming Glossary: lua_state

Casting between void * and a pointer to member function

http://stackoverflow.com/questions/1307278/casting-between-void-and-a-pointer-to-member-function

to generalize it template class T int call_int_function lua_State L this next line is problematic void T method int int reinterpret_cast.. using the first way template class T int call_int_function lua_State L void method T int int reinterpret_cast void T int int lua_touserdata..

Iterating through a Lua table from C++?

http://stackoverflow.com/questions/1438842/iterating-through-a-lua-table-from-c

lua_pop L 1 lua_next L 1 crashes etc... Naturally L is a lua_State and I'm initializing it and parsing the file okay. Edit In response.. return true bool render_func return false void test lua_State L lua_open luaL_openlibs L if luaL_dofile L levels.lua lua_pop..

How to create nested Lua tables using the C API

http://stackoverflow.com/questions/1630169/how-to-create-nested-lua-tables-using-the-c-api

#include lauxlib.h #include lualib.h int main int res lua_State L lua_open luaL_openlibs L lua_newtable L bottom table lua_newtable.. #include lauxlib.h #include lualib.h int main int res lua_State L lua_open luaL_openlibs L lua_newtable L bottom table lua_newtable..

Sending variable pointers back and forth between C++ and Lua?

http://stackoverflow.com/questions/3481856/sending-variable-pointers-back-and-forth-between-c-and-lua

in the constructor. wrap the constructor int L_newPerson lua_State L pointer to pointer person p person lua_newuserdata L sizeof.. reference the return from lua_touserdata L 1 . int L_print lua_State L person p person lua_touserdata L 1 p print return 0 int L_getAge.. p person lua_touserdata L 1 p print return 0 int L_getAge lua_State L person p person lua_touserdata L 1 lua_pushnumber L p getAge..

Redirecting/redefining print() for embedded Lua

http://stackoverflow.com/questions/4508119/redirecting-redefining-print-for-embedded-lua

redefine the print statement in C static int l_my_print lua_State L int nargs lua_gettop L for int i 1 i nargs i if lua_isstring.. NULL NULL end of array extern int luaopen_luamylib lua_State L lua_getglobal L _G luaL_register L NULL printlib lua_pop L..

Managing stack with Lua and C++

http://stackoverflow.com/questions/6511432/managing-stack-with-lua-and-c

path to file and return 0 to many strings. int error 0 lua_State L lua_open luaL_openlibs L std vector string list_strings is..

Embedding Lua in C++

http://stackoverflow.com/questions/8552560/embedding-lua-in-c

.. lua lualib.h #include .. lua lauxlib.h int main int s 0 lua_State L lua_open load the libs luaL_openlibs L luaL_dofile L example.lua.. is not mentioned in the lua 5.2 reference manual A lua_State is constructed with lua_newstate and you can use luaL_newstate..

How can I end a Lua thread cleanly?

http://stackoverflow.com/questions/862256/how-can-i-end-a-lua-thread-cleanly

if the script contains an infinite loop how can I do this lua_State Lua lua_open char code Initialisation code luaL_dostring L code.. false void IWantToQuit ms_quit true void LineHookFunc lua_State L lua_Debug ar if ar.event LUA_HOOKLINE if ms_quit true luaL_error.. if ms_quit true luaL_error L Too Many Lines Error ... lua_State Lua lua_open char code Initialisation code lua_sethook Lua LineHookFunc..

Compile lua code, store bytecode then load and execute it

http://stackoverflow.com/questions/8936369/compile-lua-code-store-bytecode-then-load-and-execute-it

functions to read a file from disk and load it into the lua_State . Alternatively you can load the file yourself into a string.. into a string and use luaL_loadstring to load it into the lua_State . Both of these functions will emit return values and compiler.. for lua_load . If the compilation was successful the lua_State now has the compiled Lua chunk as a Lua function at the top..