lua-users home
lua-l archive

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


On 28/4/19 23:39, Srinivas Murthy wrote:
I need to use this for a real-time event sampling use-case.
https://gitlab.fing.edu.uy/jvisca/ahsm does seem interesting but the cautionary note that its "very alpha quality and not tested ..." is worrisome.
I already considered removing that disclaimer. I should remove it. I 
will. Any moment now :\
Is there any other libs that you could recommend?
When I needed a plain state machine I just rolled my own following one 
of two patterns, the one from 
http://lua-users.org/wiki/FiniteStateMachine and the "functional" one  
(you can see an example of such machine parsing a protocol here: 
https://github.com/xopxe/lua-bencode-push/blob/master/bencode-push.lua). 
In these cases writing the machine felt pretty natural in the code 
itself, and I did not feel the need to use an abstracted library.
When the SM is more complex a library makes sense. We tried to use rFSM 
(https://github.com/kmarkus/rFSM), but run out of memory, and there 
seemed to be too much complexity in there. I just wrote a implementation 
based on its API. This is not the first time this happens to me, find a 
library with an API I want to use, find the implementation too complex 
or with lots of stuff I don't need, and then write my own library from 
scratch inspired by that. I suspect that means that the API is actually 
the hardest part of the library design.