lua-users home
lua-l archive

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


> BTW, is there a tool that can parse a Lua script to spot syntax
> errors?

Best is to add a metatable to globals _G that errors on index. Put
this on top of your program.

do
  local mt = getmetatable(_G) or {}
  mt.__index = function(k) error("Global "..k.." does not exist", 2) end
  setmetatable(_G, mt)
end

And then just dont code in a way, that globals validly be filled with nil.