We have done extensive research and experiments with yielding from hooks
in Lua 5. The bottom line is that this doesn't work reliably. Line hooks
almost work with little massage. Count hooks are highly unreliable and
produce all sorts of undesirable side effects. In all cases the main
source of unreliability is that the return values are not handled
properly. In the end we had to switch to using explicit yields in our scripts.
Lua is generally perceived (by me:)) as an application extension language.
IMHO, it is a programming language, I can't speak Lua nor am I aware of
anyone who can, can you?
I think if you are unloading script writing on someone, you already have
some degree of trust in them. On the other hand, it would be trivial to
add a little piece of code to Lua VM to detect a long running script and
throw an assert, simply call *lua_error* or do something else of sorts.
AB
-----Original Message-----
From: Håkon Evensen [mailto:haakon.evensen@teletopia.no]
Sent: Tuesday, July 08, 2003 2:07 AM
To: Lua list
Subject: Re: controlling lua from a c program
Thx..
But how do all people using lua solve this problem? If i write a
singlethreaded game in c, and wants to use lua as scripting, i have to
trust whoever makes the scripts for the whole games mainthread not to hang
? Is lua a scripting or a programming language? Shouldnt the
script<->mainprogram intergration almost be the most important property of
a script?
h
At 09:18 PM 7/7/2003 -0400, you wrote:
>Håkon Evensen wrote:
>>I want to execute a script but i dont want to leave the entire control of
>>the host thread in the hands of the script. is it possible to set a
>>line hook and break further execution from there?
>
>It's messy and I wouldn't do it, but where there is a will there is a
>way. Here are some references:
>
>http://lua-users.org/lists/lua-l/2003-04/msg00262.html
>
>http://lua-users.org/lists/lua-l/2003-04/msg00249.html
>