lua-users home
lua-l archive

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



On Sat, Sep 14, 2013 at 8:26 PM, Philipp Kraus <philipp.kraus@tu-clausthal.de> wrote:
Hello,

I would like to use a list structure for calling Lua function. So some explanation.
I have got a function e.g.

function test({…})
     do first call
     do some print
     do second call
     do some print again
     ….
end

I have got also a "program counter" which is started by 1. On 1 its should run "do first call" on 2 "do some print" and so on.
I would like to use a Lua function, but I would like to run this function step-by-step. I can use a if construct to check the current
"program counter value" and run the correct command, but this is not very nice.

It's not clear why you have a program counter.  If you're just using the program counter to execute the function a bit at a time but in a linear manner, you might consider using a coroutine and avoid using a program counter/state variable altogether.