lua-users home
lua-l archive

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


Hi,

There's something I'm not understanding about dofile.  The manual says:
" Returns all values returned by the chunk", so I should be able to say

   x = dofile("foo.lua")

and if foo.lua contains e.g.

{
  a:sth{ ... }
  a:sth{ ... }
  ...
}

where a:sth returns a value, then x should be a table, no?  It should be
just like saying x = { a:sth{...} ... etc.

But no matter what I do with the contents of foo.lua, x ends up nil, so
I have to make a:sth populate a global table.

I've tried the following in foo.lua:

xx = { ...
xx{...
xx = { ... } return xx
return { ... }

etc., with functions appropriately defined, as far as I can tell.  No luck.

What am I missing?

-gregg