[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple return values from require()
- From: Matthias Kluwe <mkluwe@...>
- Date: Sun, 18 Oct 2009 19:29:05 +0200
Hi!
2009/10/17 Peter Cawley <lua@corsix.org>:
> On Sat, Oct 17, 2009 at 7:01 PM, Matthias Kluwe <mkluwe@gmail.com> wrote:
>> Hi!
>>
>> 2009/10/17 Linker <linker.m.lin@gmail.com>:
>>> You can return a table instead of a list .
>>
>> Well, I know ... I can return _one_ table, but matrix.lua does return
>> two of them, and there has to be a trick (well, not a trick obviously,
>> but I can't find it in the reference manual).
>
> Look at http://www.lua.org/source/5.1/loadlib.c.html#ll_require - you
> will notice that all execution paths terminate with an error or
> "return 1;", hence require() can only return a single value.
Right. I was mislead by the above mentioned script which I assumed to
work. I checked now -- it does not.
Thank you for the clarification.
Regards,
Matthias