lua-users home
lua-l archive

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


On Mon, Apr 22, 2013 at 9:25 PM, joao lobato <btnfdp.lobato@gmail.com> wrote:
So, you want functions...

Heh, well put!  It would be nice if dofile() was allowed to pass arguments to the main chunk. E.g. we have 'dofile.lua' which is just:

print (...)

dofile() won't pass any arguments  - but it's easy to write a dofile which does take arguments:

> c = loadfile 'dofile.lua'
> c('one',1,20)
one     1       20

BTW, there is a little diffference between require() on 5.1 and 5.2:

> require 'dofile'
dofile  .\dofile.lua

That is, also passes the filename as well as the module name.

steve d.