lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi!

Can we get a local _META, like _ENV but for metatables?

s = "test"
print(s:sub(1,2))
do
local _META = {string = {__index = {sub = function(s, i, j) return "nope" end}}}
print(s:sub(1,2))
end
print(s:sub(1,2))

would output:

te
nope
te
-- 
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.