Original Post
Hi! Me again! I can't figure out why this doesn't work: "If there are no errors, lua_load pushes the compiled chunk as a Lua function on top of the stack. Otherwise, it pushes an error message." - from the Lua manual Now, I get the pushed Lua function with this code:
luaL_loadfile(L, path); // load the script lua_CFunction funct = lua_tocfunction(L,lua_gettop(L)); // get the function from the top of the stack But when I call func(L) I get a exception. I wan't to use this code cause it would allow me to execute the script multiple times just by calling the function instead of loading the whole script every time (too slow for game).