How would I load a chunk of Lua code as a char and run it using this function? If not, what other function can I use and how does lua_load() work?
Use luaL_dofile and luaL_dostring to load and run Lua code. Read their definitions in lauxlib.h to see how these are implemented in terms of lower-level primitives.
To learn how lua_load works, read the code of luaL_loadfile and luaL_loadstring.
来源:https://stackoverflow.com/questions/4272231/how-does-lua-load-work