“proper file names”?
What is it about operating systems that gets everyone so theological and partisan? Forward slashes or back slashes are just arbitrary conventions and neither is “right” or “wrong”. If anything is “wrong” here it is the ugly and error-prone “C” language use of escape sequences in strings which unfortunately was inherited by Lua.
A few messages back someone talked about the “standards based world” as opposed to Windows. A few lines further on he was lamenting the need to support four different package managers for different Linux distros! Reminded me of the famous quip:
“The great thing about standards is there are so many to choose from.”
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Robert Raschke
Sent: 09 September 2009 09:37
To: Lua list
Subject: Re: Running Lua script file from Lua Console
On Wed, Sep 9, 2009 at 8:55 AM, Peter Cawley <lua@corsix.org> wrote:
If you're entering "cmd.exe /K lua.exe" into
Start-.Run, then entering
just "lua.exe" should also work.
On Wed, Sep 9, 2009 at 8:45 AM, Robert G.
Jakabosky<bobby@sharedrealm.com>
wrote:
> Type this Lua code to execute that Lua script:
> dofile("C:\\a\\ScriptingLanguageSupport\\Lua2.lua")
Alternatively:
dofile[[C:\a\ScriptingLanguageSupport\Lua2.lua]]
The Windows backslashes are a vestige that is on it's way out.
Just use forward slashes everywhere in Lua! Everything apart from the Command
Prompt (cmd.exe) understand proper file names these days.
dofile "C:/a/ScriptingLanguageSupport/Lua2.lua"
Robby
PS The only place I ever have to use backslashes for pathnames in Windows is
when constructing a command line for os.execute(). But there you also have the
lovely task of getting your quoting right and everything is suddenly difficult.