lua-users home
lua-l archive

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


> When loadfile() or loadstring() fail they return (nil, message). The 
> message contains the line number where the error occurred. How the 
> script can obtain that line number not resorting to parsing the message 
> string?

It can't, sorry. The line number is added to the error message deep down
in the Lua core:
	http://www.lua.org/source/5.2/llex.c.html#lexerror

You can extract the line number from the error message with
	string.match(message,":(%d+):")