lua-users home
lua-l archive

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


Jose Luis Hidalgo wrote:
> D'oh, just send and see a bug XD please, remove the second 
> "int result = 0"... should be like this:
> int mylen(lua_State *L, int p)
> {
[...]
> }
> 
> But I have no compiler to test it now.... sorry.

That's the kind of C code I'd like to avoid, since it emulate code
already present in Lua core. It's redundant to implement it that way,
and redundancy is not a good thing when it's not a feature. I just
noticed the length operator is not the only one which is not exposed by
Lua API. It would be nice to have all operators accessible as C
functions, to ensure consistency between Lua code and C equivalent using
API. In the meantime I'll probably use some "function(obj) return #obj
end" Lua snippets encoded in my C files.