lua-users home
lua-l archive

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


Sorry if this is a repost, but apparently I replied to Tim privately.
My reply was meant to be public, but I notice now it didn't show in the list, so I double-checked.

When hitting the "Reply-to" button in my client (Mozilla Thunderbird) on Tim's message, it fills the "To" field with his private address, not the list's one (funny - it didn't happen with other messages I replied to).

So I repost the reply.


Tim Channon wrote:
Not seen anyone say this and is a hint

print(arg[-1])

Mmmh. I tried this.
Effectively it gives different results for different invocation paths, but it doesn't provide a clean way to detect whether the invocation has made a shell box appear.

For example, on my system here are the results:


-- invocation with "lua test.lua" from the command line
print(arg[-1])    --> lua

-- invocation inside SciTE
print(arg[-1]) --> "G:\root\main\core\Lua/app/Lua-sys/bin/lua.exe" -e SCITE_RUNNING=true; io.stdout:setvbuf 'no'" "test.lua"

-- invocation by double-clicking on test.lua inside a Windows explorer window
print(arg[-1])    --> G:\root\main\core\Lua\app\Lua-sys\bin\lua.exe

So I _could_ detect that a different invocation path has been taken, but I think it would be rather cumbersome and system specific (e.g.: what if I changed the path where the Lua interpreter resides?)

--- Lorenzo