diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/fontloader-basics-gen.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/fontloader-basics-gen.lua | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/fontloader-basics-gen.lua b/Master/texmf-dist/tex/luatex/luaotfload/fontloader-basics-gen.lua index c4d6536046a..c298f6dd975 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/fontloader-basics-gen.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/fontloader-basics-gen.lua @@ -63,15 +63,19 @@ logs = { } callbacks = { - register = function(n,f) return callback.register(n,f) end, + register = function(n,f) + return callback.register(n,f) + end, } -utilities = { - storage = { - allocate = function(t) return t or { } end, - mark = function(t) return t or { } end, - }, +utilities = utilities or { } utilities.storage = { + allocate = function(t) + return t or { } + end, + mark = function(t) + return t or { } + end, } characters = characters or { @@ -355,12 +359,28 @@ end -- +-- function table.setmetatableindex(t,f) +-- if type(t) ~= "table" then +-- f = f or t +-- t = { } +-- end +-- setmetatable(t,{ __index = f }) +-- return t +-- end + function table.setmetatableindex(t,f) if type(t) ~= "table" then - f = f or t - t = { } + f, t = t, { } + end + local m = getmetatable(t) + if f == "table" then + f = function(t,k) local v = { } t[k] = v return v end + end + if m then + m.__index = f + else + setmetatable(t,{ __index = f }) end - setmetatable(t,{ __index = f }) return t end |