main.lua

changeset 7
ecac723bb6e1
parent 3
3cc860a893d2
child 13
553ea77aa2e7
equal deleted inserted replaced
6:0c94ea0cabec 7:ecac723bb6e1
15 c = c + 1; 15 c = c + 1;
16 end 16 end
17 17
18 print("Script defines "..c.." objects, and "..#script.actions.." actions"); 18 print("Script defines "..c.." objects, and "..#script.actions.." actions");
19 19
20 for _, action in pairs(script.actions) do 20 local verse = require "verse";
21 local object = script.objects[action.object_name]; 21 require "util.logger";
22 local handler = object.handler; 22 local async = require "scansion.async";
23 assert(handler[action.action], "Objects of type '"..object.type.."' do not support action '"..action.action.."'"); 23
24 24 local runner = async.runner(function ()
25 handler[action.action](object, action.extra); 25 print("f")
26 end 26 for _, action in pairs(script.actions) do
27 local object = script.objects[action.object_name];
28 local handler = object.handler;
29 assert(handler[action.action], "Objects of type '"..object.type.."' do not support action '"..action.action.."'");
30 print(object.name, action.action.."...");
31 handler[action.action](object, action.extra);
32 end
33 end);
34
35 runner:run(true);
36 print("runner paused")
27 37
28 verse.loop() 38 verse.loop()

mercurial