Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created March 13, 2012 04:11
Show Gist options
  • Save legumbre/2026681 to your computer and use it in GitHub Desktop.
Save legumbre/2026681 to your computer and use it in GitHub Desktop.
-- make all unbound vars of the form rNN resolve to level.rings[NN]
mt={}
mt.__index=function (t, k)
local r, rindex = string.find(k, "r%d", 0)
rindex = rindex and tonumber(string.sub(k, rindex))
if rindex then
return level.rings[rindex]
else
return nil
end
end
setmetatable(_G, mt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment