lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Why not just delete running=true from your script, then after doing some initialization (calling blua), you can set running to true in your application:

lua_pushboolean(L, 1);
lua_setglobal(L, "running");

Then just re-run the script function returned by luaL_loadfile.

- Peter


Metzler wrote:

The topic might sound strange, but what i want to do, is the following :
I have a luascript like the following :

function blua()
print("x");
end

running = true;
while running do
print ("s2");
coroutine.yield(1);
end;

My problem is, that i first want the blua function to be executed and then,
anywhen later in my c code i want to start the 'normal' script. Actually,
when trying lua_dofile, he executes the whole file (but he shouldnt). And
with luaL_loadfile it just loads the file and executes the code, but it
doesnt know the blua-function.
So, how could i solve this problem ?
THX for answers