Reputation: 976
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?
Upvotes: 2
Views: 3484
Reputation: 72312
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
.
Upvotes: 4