User Tools

Site Tools


jwlua:scriptparameters

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
jwlua:scriptparameters [2013/11/21 14:29]
jariw created
jwlua:scriptparameters [2013/11/21 15:09] (current)
jariw
Line 1: Line 1:
-//JW Lua// can be configured to send specific parameters to the script.+//JW Lua// can be user configured to send specific parameters to the script. The user handles the parameters from JW Lua's //Manager// and the parameters will then be sent to the script both from JW Lua's //​Explorer//,​ Finale'​s plug-in menu or in a //Group Script//. Script Parameters are optional.
  
 +{{:​wiki:​jwlua:​scriptparameters-manager.png?​nolink|}}
  
 ==== Setting the Definition ==== ==== Setting the Definition ====
  
-//JW Lua// must know if the plug-in can handle parameters.+//JW Lua// must know if the plug-in can handle parameters. This is done in the plug-in definition.
  
 +{{:​wiki:​jwlua:​scriptparameterssetup.png?​nolink|}}
 +
 +Put each info parameter on a separate line. The syntax is almost identical to [[jwlua:​uservalueinput|finenv.UserInputValue() dialog boxes]], except that there'​s generally no quotation marks around the strings and no ''​{}''​ around lists.
 +
 +//Lists// (except for ''​NumberedList''​ items) and //init values// are optional for parameters. ​
 ==== Handle Parameter in the Script ==== ==== Handle Parameter in the Script ====
  
 +A few lines of code are required to handle parameters sent to the script. Always make sure that the script can run without sent parameters as well.
 +
 +<code lua>-- Default values, if no parameters were sent to the script
 +local resizestyle = 2
 +local relativeresize = true
  
 +-- Check if parameters were sent to the script.
 +-- If that's the case, use those values instead.
 +local parameters = {...}
 +if parameters[1] then resizestyle = parameters[1] end
 +if parameters[2] then relativeresize = parameters[2] end</​code>​
  
  
jwlua/scriptparameters.1385044197.txt.gz ยท Last modified: 2013/11/21 14:29 by jariw