[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Initial line number for luaL_loadbuffer
- From: Sean Conner <sean@...>
- Date: Thu, 15 May 2014 16:33:41 -0400
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