Hi everyone,
I have created a minimalist synchronous finite state machine using Lua closures that some of you may be interested in. The repository is located on Github: https://github.com/allsey87/luafsm
Unlike other implementations, this has been written from scratch in Lua (it is not a port from another library) and is designed for expressing complex behavior in a modular way (e.g. complex hierarchies of substates can be generated using factories). Please use the issue tracker on Github if you find any bugs or would like me to add any features.
Have fun!
A closure-based finite state machine (FSM) implementation
Re: A closure-based finite state machine (FSM) implementation
Looks interesting. What's the license for using this library?
Re: A closure-based finite state machine (FSM) implementation
I always thought closures are useless in context of making games - but looks like you proved me wrong. I would like to know in which way were closures helpful to you. (Cause I always thought closures are not worth-learning if you only want to make games with lua)
My Github- your contribution is highly appreciated
Re: A closure-based finite state machine (FSM) implementation
I have released it under an MIT license. The license is now included in the repository.
So closures in the case of this library are the states themselves which are runnable. You execute a state by running it. Since I wanted to avoid writing a function for every superstate (each of which would contain different child states), I just have a generic superstate factory function which generates closures containing the child states, exit, and entry functions as upvalues. I know that sounds a bit cryptic, but I think the only way to really get your head around it is to play with them for a bit.YoungNeer wrote: ↑Mon Jul 29, 2019 1:36 pm I always thought closures are useless in context of making games - but looks like you proved me wrong. I would like to know in which way were closures helpful to you. (Cause I always thought closures are not worth-learning if you only want to make games with lua)
Who is online
Users browsing this forum: Bing [Bot] and 0 guests