lua-users home
lua-l archive

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


Of course it can exists, but... The code will be similar to the one I
posted, look that you need to call a function, What if that function
call fails? What if the "__len" is a pice of code tha does something
invalid? IMHO calls like lua_getobjlen are supposed to not fail...

Its very easy to generalize the function to call whatever other
metamethod, I'd rather lua API as it is, simple, small and very easy
to extend... I don't see any necessity of making more complex the lua
API for such easy-to-implement-by-my-own calls... just an opinion :)

On 11/16/06, Jerome Vuarand <jerome.vuarand@ubisoft.com> wrote:

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.



--
 Jose L. Hidalgo Valiño (PpluX)
 ---- http://www.pplux.com ----