Lua一些配置

禁止全局变量的使用

setmetatable(_G, {
    __newindex = function(table, key, value)
        error("Attempt to write to undeclared global variable: " .. tostring(key), 2)
    end,
    __index = function(table, key)
        error("Attempt to read undeclared global variable: " .. tostring(key), 2)
    end,
})

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

大纲

Share the Post:
滚动至顶部