diff options
author | Pixel <pixel@nobis-crew.org> | 2009-12-27 19:45:09 +0100 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2009-12-27 19:45:09 +0100 |
commit | 6a1356a266e376bee112452a515f61ac42d2556f (patch) | |
tree | 6120ea752e97fd291e507298f09622e03b12b979 | |
parent | 551cae6794486d30bee8333c54b1586edb2913ed (diff) |
Small enhancement of the template system.
-rw-r--r-- | dalos.lua | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -665,7 +665,8 @@ dalosp.menu = { local f = preload(v) v:destroy() if not f then error("Syntax error loading file " .. dlg.value) end - local data, otype, tname = f() + local t = f() + local data, otype, tname = t.data, t.otype, t.tname local tobj = dalos.objectstypes_by_name[otype] if not tobj then error("Unknown template object type: " .. otype) end @@ -855,7 +856,8 @@ dalosp.object = { local f = preload(v) v:destroy() if not f then error("Syntax error loading file " .. dlg.value) end - local data, otype, tname = f() + local t = f() + local data, otype, tname = t.data, t.otype, t.tname if otype ~= self.ntype then error("Wrong template type: " .. otype) end self:apply_template(data.template) @@ -958,7 +960,7 @@ dalosp.object = { dumpvars(v, dalos.version, "version") v:write "if dalos.version.MAJOR < version.MAJOR or dalos.version.MAJOR == version.MAJOR and dalos.version.MINOR < version.MINOR then error 'Dalos version too old for this save.' end\n\nlocal " dumpvars(v, template, "template") - v:write("return template, '" .. self.ntype .. "', '" .. name .. "'") + v:write("return { data = template, otype = '" .. self.ntype .. "', tname = '" .. name .. "' }\n") v:destroy() else error("Failed opening " .. dlg.value .. " for writing") |