--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.lua Sat Sep 05 14:42:23 2015 +0100 @@ -0,0 +1,26 @@ +#!/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"); + +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.."'"); + + handler[action.action](object, action.extra); +end