lua-users home
lua-l archive

command-line -l option issue

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


The command-line –l option help says: -l name require library 'name'
I assumed this to be equivalent to starting a script with: require ‘name’
Now, if I have a library file named xxx.lua which also includes a function named xxx,
using the –l method vs the explicit require method does not behave the same.
To reproduce:
File xxx.lua contains just this: function xxx() print 'hello' end
And, here’s the output I get for each case:
c:\temp>lua -l xxx -e "xxx()
lua: (command line):1: attempt to call a boolean value (global 'xxx')
stack traceback:
(command line):1: in main chunk
[C]: in ?
c:\temp>lua -e "require 'xxx' xxx()
hello
Is this expected behavior, or bug? If expected, then perhaps the help message is a bit misleading.
Thank you.

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