[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_callmeta()
- From: Patrick Donnelly <batrick@...>
- Date: Fri, 12 Jun 2015 16:53:02 -0400
On Fri, Jun 12, 2015 at 3:14 PM, Tim Hill <drtimhill@gmail.com> wrote:
> What is the reason luaL_callmeta() only allows one return value? I’m guessing it’s because it’s primarily targetted for metamethods like __add(). However, it would be great if there was a luaL_callmetax() that had an explicit argument for the number of return values (or LUA_MULTRET).
>
> Not academic: All my projects to date have needed this (of course I’ve created my own, but it’s surprising that it’s not there for things like __pairs() etc).
With the exception of the special-case __call, all metamethod
operations implicitly truncate results to 1 value in the language, I
don't think a special case for C makes sense. How surprising would it
be if
a(b+1)
passed more than one argument to a?
Fortunately for __call, you can easily use lua_call instead.
--
Patrick Donnelly