diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-08-16 13:57:19 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-08-16 13:57:19 -0300 |
commit | 65434b4d1b5509e95940939e28fd90d4558da12e (patch) | |
tree | cb4f78a69bd64f8fbbf1108add57e447a85b0ee5 /testes | |
parent | 59acd79c05b78950fe03279d60b015aeed5348ab (diff) | |
download | lua-65434b4d1b5509e95940939e28fd90d4558da12e.tar.gz lua-65434b4d1b5509e95940939e28fd90d4558da12e.tar.bz2 lua-65434b4d1b5509e95940939e28fd90d4558da12e.zip |
Option '-l' can give a name for the global variable.
Sintax for this option now is '-l [globname=]modname'.
Diffstat (limited to 'testes')
-rw-r--r-- | testes/main.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/testes/main.lua b/testes/main.lua index 56959abd..52c77954 100644 --- a/testes/main.lua +++ b/testes/main.lua | |||
@@ -190,6 +190,11 @@ prepfile(("print(a); print(_G['%s'].x)"):format(prog), otherprog) | |||
190 | RUN('env LUA_PATH="?;;" lua -l %s -l%s -lstring -l io %s > %s', prog, otherprog, otherprog, out) | 190 | RUN('env LUA_PATH="?;;" lua -l %s -l%s -lstring -l io %s > %s', prog, otherprog, otherprog, out) |
191 | checkout("1\n2\n15\n2\n15\n") | 191 | checkout("1\n2\n15\n2\n15\n") |
192 | 192 | ||
193 | -- test explicit global names in -l | ||
194 | prepfile("print(str.upper'alo alo', m.max(10, 20))") | ||
195 | RUN("lua -l 'str=string' '-lm=math' -e 'print(m.sin(0))' %s > %s", prog, out) | ||
196 | checkout("0.0\nALO ALO\t20\n") | ||
197 | |||
193 | -- test 'arg' table | 198 | -- test 'arg' table |
194 | local a = [[ | 199 | local a = [[ |
195 | assert(#arg == 3 and arg[1] == 'a' and | 200 | assert(#arg == 3 and arg[1] == 'a' and |