Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Finite state machine bad argument module? — Gideros Forum

Finite state machine bad argument module?

bigtunacanbigtunacan Member
edited March 2016 in General questions
I've seen this finite state machine recommended on the forums in the past github.com/cornelisse/LuaFSM/issues

I tried setting up a very basic test usage with it, but it errors out

classes/fsm.lua:139: bad argument #1 to 'module' (string expected, got nil)

Here is my code where I tried to test it out.
FSM = require "fsm"
 
function action1()
	print("This is action 1")
end
 
function action2()
	print("This is action 2")
end
 
function action1()
	print("This is exceptionAction")
end
 
local stateTransitionTable = {
	{"state1", "event1", "state2", action1},
	{"state2", "event2", "state1", action2},
	{"*", "*", "state1", exceptionAction}
}
 
fsm = FSM.new(stateTransitionTable)
print("Initial state " .. fsm:get())
 
fsm:fire("event1")
I'm quite new to Lua, so I'm not sure if this is just something I'm doing wrong?

Comments

Sign In or Register to comment.