2 Jun 2005 04:06

## Using Lua variable in command.go



I'm absolutely obsessed with SciTE, my life was ordinary before I found it.

I've recently been setting up a "go" command for my PHP files. All my
editing is done over Samba to a development server, where all PHP files
are in a directory structure including the web hostname and path, e.g.:

\\serverName\shareName\www.site.com\path\to\file.php

I've made a Lua function which parses this string into a real URL, e.g.:

http://www.site.com/path/to/file.php

I then created another function generates the URL and launches it in my
browser, using the Lua command "os.execute".

I threw these functions in my SciTEStartup.lua file and everything
worked fine running in pure Lua:

command.name.10.*=Open In Browser
command.subsystem.10.*=3
command.shortcut.10.*=Ctrl+Enter
command.10.*=openInBrowser

However I really don't like this DOS box popup that os.execute uses (I
am REALLY anal).

What I am now attempting to do is this:

command.go.needs.*.php=constructURL
command.go.needs.subsystem.*.php=3
command.go.*.php="c:\\path\\to\\firefox.exe" \$(url)
command.go.subsystem.*.php=1

Where the "go.needs" lines (correctly) call the Lua function and
generate the URL from the file name (generated as a global Lua variable
named "url"), and the "go" command itself launches my browser.

My question is: Can I access the Lua variable in the go command?

I'm happy to post my SciTEStartup.lua file if it helps to understand
what I'm doing here (or if anyone actually wants to use it). :)

I'd greatly appreciate any help.

James


Gmane