lua-users home
lua-l archive

Re: dofile

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


David B:
> dofile() does not pass parameters to the chunk as Luiz
> points out.
Roberto:
> As he pointed out, use loadfile in that case.
Only in 5.1, though, right? In 5.0 you have to have a
function within the loadfile'd file that takes arguments.
For instance:
 -- (No error checking.)
 local filefunc = loadfile("loadfilefile.lua")
 local returnedfunc = filefunc()
 local result = returnedfunc(arg1, arg2, arg3)
-- 
Aaron

AltStyle によって変換されたページ (->オリジナル) /