lua-users home
lua-l archive

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


I am writing a GUI for Lua 5.2.2 which needs to parse error messages in
order to highlight the source. I've found an annoying inconsistency between
loading Lua strings using Lua versus using the C API:

Lua:

load(str, "ScriptPane")

ERROR:[string "ScriptPane"]:1: ...

C API:

luaL_loadstring(L, str, "ScriptPane")

ERROR:String-ScriptPane:1: ...

It does not seem to be possible to generate a consistent error format in
both cases (except by supplying a message handler to parse and re-form the
messages).

I suggest that both cases should produce the simpler format:

ERROR:ScriptPane:1: ...

If the user wants anything else (such as the prefix "string" or bracketing)
then they can specify it explicitly.

John Hind.