> Is there someplace that one can find a listing of Lua message error definitions?
A list like this would be a good addition to the reference manual. You can generate a list that picks up the error messages from the source code with the following script.
local function file_contents_get(file_str)
local str
local hnd = io.open(file_str, "r")
if hnd then
str = hnd:read("*all")
hnd:close()
end
return str
end
local tbl = {}
for j, file_str in ipairs(arg) do
local str = file_contents_get(file_str)
if str then
str = string.gsub(str, "%s+", " ")
str = string.gsub(str, "%c+", "")
str = string.gsub(str, "luaL_error", "\001")
str = string.gsub(str, "luaL_argerror", "\001")
str = string.gsub(str, "luaX_syntaxerror",
"\001")
str = string.gsub(str, "luaX_lexerror", "\001")
for err_str in string.gmatch(str,
'\001%(.-%,%s*(.-)%)%;') do
if string.match(err_str, '"') then
tbl[#tbl + 1] = err_str
end
end
end
end
table.sort(tbl)
for j, str in ipairs(tbl) do
print(str)
end
This script assumes that the names of the Lua C source files will be passed in as arguments.
--
Kurt
|