- May
- 13,190
- 180
Here are a couple things I've learned by experimentation and some working examples that might be included in the help. There's an interesting question at the end.
1. You cannot use a space or the name of an external module after -l. Perhaps the help might say
IMHO, the underscores currently in the help are confusing.
2. -e must have a space after it.
3. there's something really fishy here:
If I add anything (even nonsense) right after "lua" it works.
4. "-i" needs to be at the end of the command line.
5. More fishiness
A wild guess would be that if TCC is passing an iintact, command line to the lua dll, it should include the leading "lua" (which it doesn't, and that lua.dll is discarding the first token).
Here's the question. What does LUA's os.getenv do? It doesn't seem to get a variable after lua itself sets it or even if it's there to begin with (but created after TCC was started). It seems like the only environment lua is aware of is the one TCC had when TCC was started.
1. You cannot use a space or the name of an external module after -l. Perhaps the help might say
Code:
-lMod require the built-in Module named "Mod"
2. -e must have a space after it.
3. there's something really fishy here:
Code:
v:\> lua -e "a=1" -e "print(a)"
-e: cannot open a=1: No such file or directory
v:\>
Code:
v:\> lua nonsense -e "a=1" -e "print(a)"
1
v:\>
5. More fishiness
Code:
v:\> type script.lua
print('foo')
v:\> lua script.lua
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
>
^C
v:\> lua -e script.lua
foo
v:\> lua nonsense script.lua
foo
v:\>
A wild guess would be that if TCC is passing an iintact, command line to the lua dll, it should include the leading "lua" (which it doesn't, and that lua.dll is discarding the first token).
Here's the question. What does LUA's os.getenv do? It doesn't seem to get a variable after lua itself sets it or even if it's there to begin with (but created after TCC was started). It seems like the only environment lua is aware of is the one TCC had when TCC was started.
Code:
v:\> lua -i
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> require "winapi"
> winapi.setenv('zzz','foobar')
> print(os.getenv('zzz'))
nil
>
^C
v:\> set zzz
foobar
v:\> lua -i
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> print(os.getenv('zzz'))
nil
>