|
On 29 Nov 2012, at 23:20, Philipp Kraus wrote:
If you write each script as a module ie local function run(args) --do the calculation --don't affect globals end return run and then compile your scripts like this: void addscript(lua_State *l, string name, string script) { luaL_loadstring(l, script.c_str()); lua_pcall(l, 0, 1, 0); lua_setglobal(l, name.c_str()); } Then you have a global function for each script's run and you can do a lua_getglobal followed by a lua_call/lua_pcall to run it. Thanks, Kevin |