1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Change versioning to separate language/API/save; allow executing blocks directly; add version to game config

This commit is contained in:
Étienne Fildadut 2021-06-05 17:19:42 +02:00
parent 9388a22a0f
commit d42c35facd
4 changed files with 124 additions and 46 deletions

View file

@ -73,14 +73,24 @@ end
table.sort(files)
-- test script
if args.script then
if args.script or args.game then
local vm = anselme()
if args.lang then
assert(vm:loadlanguage(args.lang))
end
local state, err = vm:loadfile(args.script, "script")
local state, err
if args.script then
state, err = vm:loadfile(args.script, "script")
else
state, err = vm:loadgame(args.game)
end
if state then
local istate, e = vm:run("script")
local istate, e
if args.script then
istate, e = vm:run("script")
elseif args.game then
istate, e = vm:rungame()
end
if not istate then
print("error", e)
else
@ -98,12 +108,12 @@ if args.script then
end
until t == "return" or t == "error"
end
if args.save then
print(inspect(vm:save()))
end
else
print("error", err)
end
if args.save then
print(inspect(vm:save()))
end
-- run tests
else
local total, success = #files, 0