Windows Simulator

As a simulation tool for running Lua scripts on a Windows PC, the “Lua Script Functionality Simulator for Windows Use -lua-rt.ext” has been published on the public page for utilities for use by Yamaha network products.

Utilities for use by Yamaha network products
http://www.rtpro.yamaha.co.jp/RT/utility/

Using lua-rt.exe, you can do grammar checks and operational checking of lua scripts on a Windows PC. However, with relation to the router API, since this cannot operate on Windows, it only performs pseudo operations such as only doing argument checks or message output.

How to Use

Download lua-rt.exe from the Yamaha network products utility page and save it on your Windows PC. For instance, save lua-rt.ext in a folder named C:\Lua, and to do a grammar check on the script file called auto_qos.lua in that folder, input the following from the command prompt screen.

C:\>cd Lua
C:\Lua>lua-rt.exe  auto_qos.lua

rt_sleep: 30
  This is simulation, so just wait only 1sec.
lua-rt.exe: auto_qos.lua:14: bad argument #2 to 'format' (string expected, got nil)
stack traceback: 
        [C]: in function 'format'
        auto_qos.lua:14: in function 'exec_ping'
        auto_qos.lua:67: in main chunk
        [C]: ?

In the execution results in this example, a grammar error was detected on line 14 of auto_qos.lua.

To force quit a script during execution, press CTRL + C, or close the command prompt screen.

Environmental Variables

When an environment variable that uses the “set” command is defined in the router settings, and a script that reads-in the variable from the os.getenv function is run on lua-rt-exe., it is necessary to configure the environmental variables configured in the router before lua-rt.exe launches for Windows as well. To configure Windows environment variables, execute the “set” command as follows in the command prompt screen.

C:\Lua>set GATEWAY=192.168.100.10

To delete environmental variables, execute the “set” command as follows without specifying any value.

C:\Lua>set GATEWAY=

If you execute the “set” command without specifying any parameters, the environmental variables configured under Windows can be confirmed. When configuring environmental variables for use by a Lua script, be careful not to overwrite the environmental variables in use by Windows.

C:\Lua>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\rt\Application Data
CommonProgramFiles=C:\Program Files\Common Files 
	: (omitted) 
USERDOMAIN=RT-USER
USERNAME=rt
USERPROFILE=C:\Documents and Settings\rt
windir=C:\WINDOWS

File path

When a file is opened during a script, if the path indicating the file indicates a location that does not exist in the router’s external memory or on Windows, an error will result. Additionally, you cannot use a relative path that uses a PWD.

fdw, err = io.open("sd1:/output.txt", "ab") 	-- will result in error

In this case, change to designate the location on Windows as in the following.

fdw, err = io.open("C:\output.txt", "ab")

Return to Top