lua-users home
lua-l archive

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


Op So. 7 Apr. 2019 om 17:55 het Sergey Kovalev <kovserg33@gmail.com> geskryf:

TL;DR
>
>     return load([[
>         function strict(s)
>             return setmetatable({},{
>                 __index=function(t,n)
>                     if s[n]==nil then error("no "..n.." defined",3) end
>                     return s[n]
>                 end,
>                 __newindex=function(t,n,v)
>                     if s[n]==nil then error("no "..n.." defined",3) end
>                     s[n]=v
>                 end,
>             })
>         end
>         local _ENV=strict{} return function ]]..fn.." end")()

That last 'end' is probably wrong.