[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: executing functions from file, without using luaL_dofile
- From: jseb <gmane2010@...>
- Date: Mon, 02 May 2011 15:38:58 +0200
To clarify, i have a Lua script which look like this:
-- main lua script
--this function is launched in a thread
dll:launch_computing(computing) --the 2nd thread
local is_quitting = dll:redraw() -- main thread
As Lua is not reentrant, i cannot call the "computing()" function
straight from the DLL.
Then, i've created an new lua_State in the DLL, and i use it for
reloading the whole lua script above.
(i get the script name with arg from the "main" Lua state)
But if i execute the script after reloading it, it will call again and
again the thread creation (rapid stack overflow).
I know that you're thinking it would be easier to store "computing"
function in another script file, anyway i cannot access global variables
from main Lua script.
That's what i'm going to do. I was asking about "on demand" function
compilation just out of curiosity.