[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Multiple return values from require()
- From: Matthias Kluwe <mkluwe@...>
- Date: Sat, 17 Oct 2009 13:27:46 +0200
Today I had the idea to return multiple object contruction functions
from a module. Suppose I have a file "mod.lua":
local function f1()
local function f2()
return f1, f2
Unfortunately, only one of them is returned by require:
> lua -e 'print( require "mod" )'
I had the idea after seeing something similar in LuaMatrix
(http://luamatrix.luaforge.net/) which returns two tables at the end
of matrix.lua. These are assigned by 'local matrix, complex = require
"matrix"' in test_matrix.lua, for example.
Clearly, I am missing something here.