lua-users home
lua-l archive

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


> Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> hat am 16. Mai 2014 um 02:00 geschrieben:
>
> > 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.
>
> You don't need to patch Lua. You can simply provide your own reader function
> that first sends n newlines and then the actual code. It can be done in Lua
> and in C.
 
Right, that would work. We would still consider initialising the line number with the correct value to be a more elegant solution, but it's not a big issue.
 
For the time being we will just paste some newlines in front of the source chunk, that's even easier (at least in C++, which we are using as host language).
 
Thanks, Colin