[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Is there a C API equivalent to the new # operator for tables?
- From: Glenn Maynard <glenn@...>
- Date: Thu, 16 Nov 2006 17:43:07 -0500
On Thu, Nov 16, 2006 at 11:29:05PM +0100, Jose Luis Hidalgo wrote:
> 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...
It would be consistent for it to act like lua_gettable: fail if a
metamethod fails, with "lua_objlenraw" as the current function.
> 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 :)
You shouldn't need to implement calls yourself that Lua has already
implemented. That just leads to inconsistent behavior and redundant