I want to create FSM in Lua (using Luabind). Let's say I have GameObject, in lua file I do write this:
State1 = {}
State1["Start"] = function()
end
State1["Update"] = function()
if (blah blah blah) then
ChangeState(State2);
end
end
State1["End"] = function()
end
... then states 2, 3 and etc...
gameObject.fsm = CreateFSMComponent(name, State1);
The question is - how to create the SAME object behavior with a DIFFERENT properties? Like.. if I would like to create 2 patrolling units with the same behavior but each of them would have the different start position. But in Lua - when I define external functions to describe these states within it - it doesn't work.