lua-users home
lua-l archive

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


Just wondering if there's a compelling reason not to do this. Right
now if you want to load a script and pass some arguments to it, you
have to do:
loadfile('myscript.lua')(a, b, c)
and if you want to handle errors, it gets uglier:
assert(loadfile('myscript.lua'))(a, b, c)

It seems like a simple, useful change would be to allow dofile() to
pass arguments:
dofile('myscript.lua', a, b, c)

Thoughts? Of course this can be done pretty easily within Lua itself,
but I'm not terribly fond of replacing built-in functions like that.
Is there a reason this couldn't be done in a future version of Lua?
Will bad things happen to me if I wrap dofile() in my scripts to do
this? To me it seems to be in the spirit of Lua: a tiny change that
makes our code simpler. But I wonder if there's some detail I've
missed that would make it a bad idea...

-- 
Sent from my toaster.