lua-users home
lua-l archive

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


Hi!

Today I had the idea to return multiple object contruction functions
from a module. Suppose I have a file "mod.lua":

   local function f1()
      -- ...
   end

   local function f2()
      -- ...
   end

   return f1, f2

Unfortunately, only one of them is returned by require:

> lua -e 'print( require "mod" )'
function: 0x95a84b0

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.

Regards,
Matthias