Skip to content
Snippets Groups Projects
Commit 43b76f4f authored by DarkGod's avatar DarkGod
Browse files

Improve lore templating capabilities

parent b32525d2
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ function _M:loadDefinition(file, env)
local f, err = loadfile(file)
if not f and err then error(err) end
setfenv(f, setmetatable(env or {
Lore = self,
newLore = function(t) self:newLore(t) end,
load = function(f) self:loadDefinition(f, getfenv(2)) end
}, {__index=_G}))
......@@ -78,7 +79,7 @@ function _M:getLore(lore, silent)
if l.template then
local tpl = slt2.loadstring(l.lore)
l.lore = slt2.render(tpl, {player=self:findMember{main=true}, self=self})
l.lore = slt2.render(tpl, {player=self:findMember{main=true}, self=self, Lore=_M})
end
return l
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment