hsm_statechart

State machine engine based on UML statecharts.

$ luarocks install hsm_statechart

hsm-statechart is a hierarchical statechart engine, written in C.
The Lua extension makes it dead simple to write statemachines:
you just declare a table.

chart = { state= { event= function() end, substate={ ... } } }

Both event handlers and states are key:value pairs.
Event names map to functions ( or, for simple transitions, directly to a state name ),
while states names map to sub-tables.

After defining a statechart, two calls: hsm= hsm_statechart( chart ) and hsm.signal( event_name )
are all that are need to run the statemachine.

Statemachines can be used for everything from building roboust text parsers,
to managing the control flow for applications, or even writing AI in games.

Versions

0.5-110 years ago1,430 downloads

Dependencies

lua >= 5.1

Labels

Manifests