lua-users home
lua-l archive

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

doing a "multireply" in order not to pollude the list:

--- Fabien wrote:

> Metalua has internal gotos and labels, for which you
> can easily create
> macros to use them in the language (untested code):

sounds good, I'll have a look at metalua while
evaluating the options.

> Put these statements into functions, these functions
> into a table, and
> execute all elements of the table:
> my_routine =
> { function() print "stat 1" end,
>   function() print "stat 2" end,
>   function() print "stat 3" end }

it's a very good idea, I'd never have thought of doing
something like this.... it's clear that I'm still a
lua newbie :)

in order to avoid the heavy sintax I could put the
"normal" code in a common .lua, and change it to the
next syntax in runtime (I mean generating a new .lua
based on the old one, which would be adapted to this
new "format")

the only problem I can think of is that I don't know
if the debugger I'm using would support the debug of
this kind of files...

--- "Andrew Fray" wrote:

>Your best bet might be constructing some kind of
>finite state machine 
>and a lua-based interpreter/ide.  IMO that's better
>than trying to hack around with the byte code, and
>lua's so fast to 
>develop in that you may find it doesn't take too much

mmm... what do you mean exactly? a lua interpreter
from lua?

--- "Niklas Frykholm" wrote:

>Even if you manage to rewind/jump in the Lua code
>won't you still have 
>the problem of rewinding the C side, i.e. moving NPC1
>back five steps 
>you rewind over step 2? Seems like a difficult
problem >to be able to 
>the script code and everything it does both forwards
>and backwards.

my idea was that, once each "single instruction" is
executed (using the debug hook feature), saving the
game status in a stack, and restoring them if a step
back occurred. To avoid great amounts of memory
needed, the zones where code could be interactively
edited would be determined by some kind of marks (i.e.
a call to a function interactiveEditStart() ).

The "fake rewind" system by "fast fowarding" was the
first one I thought (I didn't post it in the original
post), but I'd prefer something that would operate
directly on lua (I thought it'd be easier to keep
track of executed lines, ...). It's my plan B ;)

--- "Dmitriy Iassenev"

>I am interested in this too :)
>So, is edit&continue possible in Lua? It would be
very >useful, since
>there are lots of typos due to dynamic nature of the

well, I suppose it depends on the nature of each
project, but when I executed something in a past
project and had a lua error, it entered an infinite
loop showing the error, and the program waited for the
script to be modified, reloaded and reexecuted.
The problem I have now is that those functions are in
coroutines, so it's harder to replace those functions.

by the way (general question), is there a way to
obtain a list of current executed coroutines and the
line & file they're stopped by?


Send instant messages to your online friends