Ported Lua state machine to Dart