lua-users home
lua-l archive

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


Joe Andresen wrote:
> I tried those two lines and got the exact same error.

Then something is seriously broken in your copy of Lua or in
the way you embed it.

> I'm using lua source 5.1.4
> 
> and latest bit op (source) version 1.0.1
> 
> i am compiling with visual studio 2008.

That should work just fine. Have you compiled the sources using
the provided etc/luavs.bat? Or have you compiled Lua as C++ code?
(not generally recommended)

> I was sure to add the two chunks of code in the install part of the website
> and recompiled several times.

I'd always suggest to try it with the command line lua.exe first.

> the first couple of asserts work in the test code but the pcall's do not.
> 
> i use pcall from c in other parts of code and it works fine.

Ok, but does it actually catch errors, too?

Since Lua's pcall() library function just calls into lua_pcall()
it would be a bit surprising to see a difference.

Perhaps something in your code is replacing the pcall() function?
E.g. there are broken versions of coxpcall out there.

Or have you installed an error handler (like debug.traceback)?
Note that the error handler must not throw an error itself or
abort the process in any way. It should only return a string.

> I'm pretty sure i havent changed the source in that sense....  the error
> says it is expecting a number not a string. Could it be that i missed
> something somewhere where the bitop functions are strings instead of
> numbers??

Nope, the error message you quoted is correct. Your problem has
little to do with Lua BitOp. You're just seeing a symptom in the
test cases. Error handling is part of the Lua core.

--Mike