lua-users home
lua-l archive

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


I've thought about writing something similar.  The way I was going to do it
was to wrap all the robot operations in calls that decremented a count
yielded to the other robots when the count was negative.  That way you can
set the counter to say 1000000 and have different operations have different
costs, maybe sin(x) cost 1 point of time but shoot_laser() cost 1000 points.

Basically move the time counting up into the routines that do work and not
in the byte code.  You loose granularity but you gain weighting control of
each operation.  I guess you could do both if you had a the VM decrement the
count for each bytecode, then the next call to a wrapped function would
include to overhead of the bytecodes before it --- if there's no simulation
'advantage' to completing t.x = 4 then that will work.

Of course, your needs might be vastly different.

Russ

> From: Gabriel Peyré <nikopol0@altern.org>
> Reply-To: lua-l@tecgraf.puc-rio.br
> Date: Fri, 15 Mar 2002 20:26:41 +0100
> To: Multiple recipients of list <lua-l@tecgraf.puc-rio.br>
> Subject: running LUA code step by step
> 
> sorry if this question has already been asked ...
> 
> I am trying to run multiple LUA chunks of code at the same time
> (to make a kind of codeware with robots scripted in LUA).
> To do that I need to process each LUA code one intruction by one
> instruction (or at least line by line), but I didn't manage to do it.
> I've try using the line hook, but without great success ...
> 
> thanks a lot for your attention.
> 
> - gabriel -
>