lua-users home
lua-l archive

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


It was thus said that the Great Colin once stated:
> Hi All,
> 
> in our use of Lua we have stumbled over a small issue regarding the readability
> of parser error messages. This issue arises due to the fact that we often have
> Lua scripts embedded in other files, so the Lua parser believes to start in line
> 1, when it actually is somewhere else in the file.
> 
> We would like to suggest the inclusion of the attached patch against
> lua-5.3.0-work2, which adds a new macro named luaL_loadbuffern. It behaves just
> like the - kept for compatibility - luaL_loadbuffer, except that it takes an
> additional integer argument with which the line number counter in the parser is
> initialised.

  +1.

  Also, is there an easy way to get the line number in Lua, much like C has
__LINE__?  Because it would help me with error reporting with my C compiler
module [1][2].

  -spc

[1]	https://github.com/spc476/lua-conmanorg/blob/master/lua/cc.lua

[2]	Which relies upon the wrapper for TCC:
	https://github.com/spc476/lua-conmanorg/blob/master/src/tcc.c