[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: No line number on nil function?
- From: Roberto Ierusalimschy <rieru@...>
- Date: Wed, 13 Feb 2002 16:26:28 -0600 (CST)
On Wed, 13 Feb 2002, J. Perkins wrote:
> In my project, I have patched into luaD_error(), where I intercept
> scripting errors, add on file and line number information using the
> code from luaB__ERRORMESSAGE, and then quit the app (code available
> on request).
> If a syntax error occurs in a script this works fine, but if a
> script tries to call a function that doesn't exist, ie. "attempt to
> call global 'XXX' (a nil value)", no file/line info is available.
> That is to say, 'lua_getstack(L, 1, &ar)' returns zero. In this
> case, is there anyway to get the file/line where the error occurred?
This case seems to work fine wiht regular Lua:
Lua 4.0 Copyright (C) 1994-2000 TeCGraf, PUC-Rio
error: attempt to call global `f' (a nil value)
1: main of string "f()" at line 1
Maybe there is something wrong with your patch? Do you (Lua)call a
function to handle the error? (Otherwise, the error would be on
level 0 in lua_getstack, not level 1...)