Or I guess it is more correct to say the function returned.
I’m trying to figure out how to save the chunk returned by functions such as luaL_loadbuffer (I assume it is a pointer). For example, if I run the follow C code, my Lua code will run just fine.
if( luaL_loadbuffer(L, testPtr, scriptLen, "luaScript") )
fprintf(stderr, "%s\n", lua_tostring(L, -1));
if ( lua_pcall(L, 0, 0, 0) )
fprintf("%s\n", lua_tostring(L, -1));
What I would like to do is save off the returned chunk on the stack so I can later push it onto the stack and run the compiled code again. I’m sure this is simple, but I haven’t found the solution yet.