lua-users home
lua-l archive

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


Hi all
I'm new to lua but from my first tests it is like to be great
embeddable language.

I'm learning lua with small fsm machine built in C and all actions are
built in lua.
FSM is described with: old_state, event, new_state and action.

    state1, event1, state2, action1
    state1, event2, state3, action2
    etc..

So: if in state1 there is event1 fsm execute action action1 and goes to
state 2.

With this architecture I can easily change all actions, just change
actions.lua file.

But to change whole fsm i have to change fsm.c file where fsm is
described and recompile.

Now, I like to describe fsm in lua, maybe in lua table or ?.
Then, I will dynamically build fsm transition table in my main C
program and maybe destroy lua table to not waste memory.

So, this is what I like to do, but I don't know how to do that.

I'm looking for help from this group.

Best Regards, Romeo