Lua scripting supports to define arguments to scripts that can be created dynaimically.
It is easy to setup the arguments in your script as follows:
beginArgumentSection(Name)
For every argument you will have to write it's type and name that describes it like:
addArgument[Boolean | Integer | Real | String | Shape](NameArgument)
If you don't want default values for them, you will be able to setup them like this:
setArgument[Boolean | Integer | Real | String | Shape](NameArgument, newValue)
At the end you will need to execute function: showArguments()
To use in your script simply assign your variables with getter functions as follows:
luaVariable = getArgument[Boolean | Integer | Real | String | Shape](NameArgument)
For the predefined gear in the previous blog post, there were 5 parameters, 4 reals and one integer. To setup them the code for it is as follows:
beginArgumentSection("Gear")
addArgumentReal("Inner Range", "Inner angle")
setArgumentReal("Inner Range", 320)
addArgumentReal("Outer Range", "Outer Range")
setArgumentReal("Outer Range", 400)
addArgumentReal("Inner Angle Ratio", "Inner Angle Ratio")
setArgumentReal("Inner Angle Ratio", 0.4)
addArgumentReal("Outer Angle Ratio", "Outer Angle Ratio")
setArgumentReal("Outer Angle Ratio", 0.2)
addArgumentInteger("Steps", "Gear Steps")
setArgumentInteger("Steps", 20)
showArguments()
inner_range = getArgumentReal("Inner Range")
outer_range = getArgumentReal("Outer Range")
inner_angle_ratio = getArgumentReal("Inner Angle Ratio")
outer_angle_ratio = getArgumentReal("Outer Angle Ratio")
steps = getArgumentInteger("Steps")
In this way hopefully more complex scripts can be created as they will give feedback to user to create as complex scripts as they wish.
Those days I've also look for simple crashes that are in the actual code base and will give to you less chances to crash Naro from SVN version. Also, there is a Lua shape() function that will offer a way to you to pick your shape visually. There is a help() lua function that will bring to you a help window. The bad thing is that the Lua functions are not yet documented but they will be really soon.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment