lua-users home
lua-l archive

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


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