lua-users home
lua-l archive

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


Hi,

I'm using Lua 5.0.2.

After calling lua_getinfo() the short_src member of the lua_Debug structure
passed in can contain line endings which seem to confuse printf(), and as a
result error printouts are unhelpful. This only happens if the source code
has non-unix line endings (i.e. not just plain '\n').

Suggested solution is to modify lobject.cc on line 182 (function
luaO_chunkid):

int len = strcspn(source, "\n");  /* stop at first newline */

to take into account other possibilities... so to handle unix and DOS line
endings properly:

int len = strcspn(source, "\n\r");  /* stop at first newline */

I don't know if that works for MAC line endings though.


Regards,

Vadim.