Module:Sandbox/Artoria2e5/Fallback: Difference between revisions

Content deleted Content added
mNo edit summary
m Plastikspork moved page Module:Arguments/Fallback to Module:Sandbox/Artoria2e5/Fallback without leaving a redirect: Per user request
 
(One intermediate revision by one other user not shown)
Line 59:
 
return makeFallback
 
--[[
P.S. Don't blame me for writing these obj-states. Sure, we can use an
accumulator and do some "index with acc" ourselves, but that sounds like too
much work done just to avoid states.
 
Here is that custom index function in case anyone is curious about it:
 
function index_w_acc(t, k, acc)
local v = rawget(t, k)
if v ~= nil
return v
else
return getmetatable(t).__index(k, acc)
end
end
 
My guess is that it will certainly be slower than the native t[k] one. Perhaps
not getting the metatable every time will help a bit.
]]--