lua-users home
lua-l archive

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


Title: RE: lua_Debug and currentline

Whoops.  Rookie mistake.  I was indeed ignoring the return code of loadbuffer.  I think that may also have been making the line numbers meaningless.

Thanks for the speedy response.

Tom (blushes, and slips quietly back into the shadows)

> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br
> [mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of
> Julien Cugnière
> Sent: 26 June 2006 10:59
> To: Lua list
> Subject: Re: lua_Debug and currentline
>
>
> 2006/6/26, Tom Miles <Tom@creative-assembly.com>:
> > I do get some rather strange error messages though, my
> favourite being
> > "attempt to call a string value" when there is a syntax
> error (such as
> > missing 'then' after an 'if').
>
> It sounds a lot like you're calling lua_pcall even when
> luaL_loadbuffer fails! If there is a syntax error (such as missing
> 'then'), luaL_loadbuffer returns LUA_ERRSYNTAX and pushes an error
> message on the stack, instead of a function. You should report that
> message instead of calling lua_pcall, which would of course report
> "attempt to call a string value".
>
> > This however, rarely points to a meaningful line in the
> script, so what
> > exactly does it relate to?  Is it the compiled line, or source line?
>
> It's supposed to be the source line in the string you passed to
> loadbuffer, so you must be doing something wrong...
>
> --
> Julien Cugnière
>