summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sto.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-12-02 22:25:24 +0000
committerKarl Berry <karl@freefriends.org>2015-12-02 22:25:24 +0000
commit8a154ca7d78ee39d443c3f43d9cb86ff1d71b411 (patch)
treeaece0f86dda1a199e831661af24593dc4184b1e9 /Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sto.lua
parentcd10cbba5784b911a3028369ffaa9e87e9a746aa (diff)
lualibs (2dec15)
git-svn-id: svn://tug.org/texlive/trunk@38998 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sto.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sto.lua21
1 files changed, 6 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sto.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sto.lua
index 8aafca425b8..d21267d7a8c 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sto.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sto.lua
@@ -113,22 +113,16 @@ local f_index = {
["number"] = f_number,
}
-local t_index = {
- ["empty"] = { __index = f_empty },
- ["self"] = { __index = f_self },
- ["table"] = { __index = f_table },
- ["number"] = { __index = f_number },
-}
-
function table.setmetatableindex(t,f)
if type(t) ~= "table" then
f, t = t, { }
end
local m = getmetatable(t)
+ local i = f_index[f] or f
if m then
- m.__index = f_index[f] or f
+ m.__index = i
else
- setmetatable(t,t_index[f] or { __index = f })
+ setmetatable(t,{ __index = i })
end
return t
end
@@ -137,19 +131,16 @@ local f_index = {
["ignore"] = f_ignore,
}
-local t_index = {
- ["ignore"] = { __newindex = f_ignore },
-}
-
function table.setmetatablenewindex(t,f)
if type(t) ~= "table" then
f, t = t, { }
end
local m = getmetatable(t)
+ local i = f_index[f] or f
if m then
- m.__newindex = f_index[f] or f
+ m.__newindex = i
else
- setmetatable(t,t_index[f] or { __newindex = f })
+ setmetatable(t,{ __newindex = i })
end
return t
end