Sat, 05 Sep 2015 23:28:54 +0100
basic.scs: Small changes to make work
#!/usr/bin/env lua5.1 local parser = require "scansion.parser"; io.input(arg[1]); local script_data = io.read("*a"); local script = assert(parser.parse(script_data)); local c = 0; for name, object in pairs(script.objects) do local o = require("scansion.objects."..object.type); object.handler = o; o._validate(object); c = c + 1; end print("Script defines "..c.." objects, and "..#script.actions.." actions"); local verse = require "verse"; require "util.logger"; local async = require "scansion.async"; local runner = async.runner(function () print("f") for _, action in pairs(script.actions) do local object = script.objects[action.object_name]; local handler = object.handler; assert(handler[action.action], "Objects of type '"..object.type.."' do not support action '"..action.action.."'"); print(object.name, action.action.."..."); handler[action.action](object, action.extra); end end); runner:run(true); print("runner paused") verse.loop()