lua-users home
lua-l archive

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


> Is there an official way to evaluate errors so that I am able to
> different between e.g. loadfile(<File>) failed because file not found or
> failed because code is corrupt?

If the error message begins with "cannot read", then the error is definitely
LUA_ERRFILE. Otherwise, it's probably LUA_ERRSYNTAX (but it might be
LUA_ERRMEM or even LUA_ERRERR). I think it's pretty safe to check only
"cannot read".

However, note that LUA_ERRFILE does not always mean that the file does not
exist. It may be unreadable due to lack of permission or it may be a directory
or something.

Why do you need to make this difference?

> Is the error message fixed so that evaluation is assured in a long-term?

We have no plans to change them but cannot promise they won't change.