1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00
This commit is contained in:
Étienne Fildadut 2024-01-03 13:49:24 +01:00
parent 4c76ef5f96
commit 12c32bb8a2
4 changed files with 6 additions and 6 deletions

View file

@ -15,7 +15,7 @@
-- --
-- -- read an anselme script file -- -- read an anselme script file
-- local f = assert(io.open("script.ans")) -- local f = assert(io.open("script.ans"))
-- local script = anselme.parse(f:read("*a"), "script.ans") -- local script = anselme.parse(f:read("a"), "script.ans")
-- f:close() -- f:close()
-- --
-- -- load the script in a new branch -- -- load the script in a new branch
@ -33,7 +33,7 @@
-- for i, l in ipairs(data) do -- for i, l in ipairs(data) do
-- print(("%s> %s"):format(i, l:format(run_state))) -- print(("%s> %s"):format(i, l:format(run_state)))
-- end -- end
-- local choice = tonumber(io.read("*l")) -- local choice = tonumber(io.read("l"))
-- data:choose(choice) -- data:choose(choice)
-- elseif e == "return" then -- elseif e == "return" then
-- run_state:merge() -- run_state:merge()

View file

@ -113,7 +113,7 @@ State = class {
-- --
-- This can be loaded back later using `:load`. -- This can be loaded back later using `:load`.
save = function(self) save = function(self)
local struct = persistent_manager:capture(self) local struct = persistent_manager:get_struct(self)
return binser.serialize(anselme.versions.save, struct) return binser.serialize(anselme.versions.save, struct)
end, end,
--- Load a string generated by `:save`. --- Load a string generated by `:save`.

View file

@ -32,7 +32,7 @@ local persistent_manager = class {
end, end,
-- returns a struct of the current persisted variables -- returns a struct of the current persisted variables
capture = function(self, state) get_struct = function(self, state)
local persistent = state.scope:get(persistent_identifier) local persistent = state.scope:get(persistent_identifier)
return persistent:to_struct(state) return persistent:to_struct(state)
end end

View file

@ -35,7 +35,7 @@ end
local function process(content) local function process(content)
return content:gsub("{{(.-)}}", function(lua_file) return content:gsub("{{(.-)}}", function(lua_file)
local f = io.open(lua_file, "r") local f = io.open(lua_file, "r")
local c = f:read("*a") local c = f:read("a")
f:close() f:close()
local output = {} local output = {}
@ -74,7 +74,7 @@ end
local function generate_file(input, output) local function generate_file(input, output)
local f = io.open(input, "r") local f = io.open(input, "r")
local content = f:read("*a") local content = f:read("a")
f:close() f:close()
local out = process(content, output) local out = process(content, output)