Scripting Reference

Properties, methods, and events for document elements that can be manipulated from script. 

Shared Members

These members are shared by all elements that are accessible using Lua.

Properties

  • Name: local elementName = element.Name;

  • Parent: local parent = element.Parent

  • ReferenceString: local ref = element.ReferenceString;

  • Style:

    • ForegroundColor

      • elementName.Style.ForegroundColor = color.blue;

      • styleName.ForegroundColor = color.white;

    • BackgroundColor

      • elementName.Style.BackgroundColor = color.rgb(15, 125, 64);

      • styleName.BackgroundColor = color.red;

    • MarginLeft, MarginRight, MarginTop, MarginBottom

      • elementName.Style.MarginLeft = 0.5;

      • styleName.MarginRight = 20;

    • Bold, Italic, Underline

      • elementName.Style.Bold = true;

      • styleName.Italic = false;

    • Visibility (visible, hidden, collapsed)

      • elementName.Style.Visibility = "collapsed";

      • if elementName.Style.Visibility == "Collapsed" then...

    • Subscript, Superscript

      • elementName.Style.Subscript = true;

    • TextAlignment (left, right, center)

      • elementName.Style.TextAlignment = "right"

    • FontSize

      • elementName.Style.FontSize = 2;

      • styleName.FontSize = 0.8;

Accelerometer

Properties

  • Value (vector)

    • local accelData = myAccelerometer.Value;

  • X

    • local xValue = myAccelerometer.X;

  • Y

    • local yValue = myAccelerometer.Y;

  • Z

    • local zValue = myAccelerometer.Z;

  • Reorient

    • myAccelerometer.Reorient = true;

Events

  • onValueChanged

    • Inherent vector value

  • onActivePageChanged

    • Inherent variable active

      • if active then ...

Methods

  • Start: myAccelerometer:Start()

  • Stop: myAccelerometer:Stop()

Button

Properties

  • AlternateText

    • local altText = myButton.AlternateText;

    • myButton.AlternateText = "This is a button.";

  • Text

    • local butText = myButton.Text;

    • myButton.Text = "Button";

Methods

  • Click: myButton:Click();

Events

  • onClick

Client

Properties

  • Uri

    • clientName.Uri = "tcpip://192.168.0.11:5020"

Events

  • onConnected

  • onDisconnected

  • onReceive

Device

Properties

  • CurrentOrientation

    • if application.device.CurrentOrientation == enum.DeviceOrientation.Portrait then...

    • if application.device.CurrentOrientation == enum.DeviceOrientation.Landscape then...

    • if application.device.CurrentOrientation == enum.DeviceRotation.Rotated0 then...

    • if application.device.CurrentOrientation == enum.DeviceRotation.Rotated90 then...

    • if application.device.CurrentOrientation == enum.DeviceRotation.Rotated180 then...

    • if application.device.CurrentOrientation == enum.DeviceRotation.Rotated270 then...

  • IsNetworkAvailable

    • if application.device.IsNetworkAvailable then...

  • IsTablet

    • if application.device.IsTablet then...

Document

Properties

  • Title

    • myDocument.Title = "This is the name of the document";

    • local docTitle = myDocument.Title;

Footer

Properties

  • Level: local footLevel = theFooter.Level;

  • Title

    • theFooter.Title = "This is the footer";

    • local footTitle = theFooter.Title;

Gyroscope

Properties

  • Value (vector)

    • local gyroData = myGyro.Value;

  • X

    • local xValue = myGyro.X;

  • Y

    • local yValue = myGyro.Y;

  • Z

    • local zValue = myGyro.Z;

  • Reorient

    • myGyro.Reorient = true;

Events

  • onValueChanged

    • Inherent vector value

  • onActivePageChanged

    • Inherent variable active

      • if active then ...

Methods

  • Start: myGyro:Start()

  • Stop: myGyro:Stop()

Header

Properties

  • Level: local headLevel = theHeader.Level;

  • Title

    • theHeader.Title = "This is the header";

    • local headTitle = theHeader.Title;

Fields

  • References: local refs = theHeader.References;

Image

Properties

  • AlternateText

    • local altText = myImage.AlternateText;

    • myImage.AlternateText = "This is an image.";

  • ImageSource

    • local image = myImage.ImageSource;

    • myImage.ImageSource = "images/image1.png";

Location

Properties

  • Value (vector)

    • local locData = myLocation.Value;

  • Latitude

    • local latValue = myLocation.Latitude;

  • Longitude

    • local longValue = myLocation.Longitude;

  • Altitude

    • local altValue = myLocation.Altitude;

  • Speed

    • local speedValue = myLocation.Speed;

  • Bearing

    • local bearValue = myLocation.Bearing;

  • Timestamp

    • local timeValue = myLocation.Timestamp;

Events

  • onValueChanged

    • Inherent vector value

  • onActivePageChanged

    • Inherent variable active

      • if active then ...

Methods

  • Start: myLocation:Start()

  • Stop: myLocation:Stop()

Magnetometer

Properties

  • Value (vector)

    • local magData = myMagnetometer.Value;

  • X

    • local xValue = myMagnetometer.X;

  • Y

    • local yValue = myMagnetometer.Y;

  • Z

    • local zValue = myMagnetometer.Z;

  • Reorient

    • myMagnetometer.Reorient = true;

Events

  • onValueChanged

    • Inherent vector value

  • onActivePageChanged

    • Inherent variable active

      • if active then ...

Methods

  • Start: myMagnetometer:Start()

  • Stop: myMagnetometer:Stop()

Paragraph (p)

Properties

  • FormattedText

    • myParagraph.FormattedText = "Here is a paragraph";

    • local pText = myParagraph.FormattedText;

  • Text

    • myParagraph.Text = "Here is text without formatting";

    • local pText = myParagraph.Text;

Plot

Properties

  • Axis Minimum

    • local myMin = plotName.YAxis.Min;

  • Axis Maximum

    • local myMax = plotName.YAxis.Max;

  • Scaling Mode

    • local xScaling = plotName.XAxis.Scaling;

    • plotName.YAxis.Scaling = "growAndShrink"

  • Series Capacity

    • local myCap = plotName.seriesName.Points.Capacity;

  • Series Count

    • local myCount = plotName.seriesName.Points.Count;

  • Draw Mode

    • plotName.seriesName.DrawMode = enum.DrawMode.RadialFill;

  • Visibility

    • plotName.seriesName.Visible = true

Methods

  • Axis Reset to Defaults: plotName.XAxis:SetDefaults();

  • Axis Range: plotName.YAxis:SetRange(y1, y2)

  • Add Point: plotName.seriesName:Add(x, y)

    • Add point without defining series: plotName.Series[1]:Add(x,y)

  • Add nx2 Matrix: plotName.seriesName:Add(matrixName)

  • Clear Series: plotName.seriesName:Clear()

  • Plot Reset to Defaults: plotName:Reset()

Section

Properties

  • Level: local secLevel = theSection.Level;

  • Title

    • theSection.Title = "This is a section";

    • local secTitle = theSection.Title;

Simulation

For the properties of simulation elements refer to Simulation Properties

Properties

  • Time

    • local simTime = mySim.Time

  • Duration

    • local simDuration = mySim.Duration

  • Period

    • local simPeriod = mySim.Period

  • Running (onStateChanged)

    • local checkState = mySim.Running

  • Paused (onStateChanged)

    • local checkState = mySim.Paused

  • Stopped (onStateChanged)

    • local checkState = mySim.Stopped

Events

  • onUpdate

  • onDuration

  • onActivePageChanged

    • Inherent variable active

      • if active then ...

  • onStateChanged

    • variable state

      • if state == mySim.Running then ...

      • if state == mySim.Paused then ...

      • if state == mySim.Stopped then ...

Methods

  • Start: mySim:Start()

  • Stop: mySim:Stop()

  • Pause: mySim:Pause()

  • Resume: mySim:Play()

  • IsRunning: local trueFalse = mySim:IsRunning()

  • IsPaused: local checkPaused = mySim:IsPaused()

  • IsStopped: local stopped = mySim:IsStopped()

Slider

Properties

  • InitialValue

    • mySlider.InitialValue = 5.0;

    • local initVal = mySlider.InitialValue;

  • MaxValue

    • mySlider.MaxValue = 10.0;

    • local maxVal = mySlider.MaxValue;

  • MinValue

    • mySlider.MinValue = 0.0;

    • local minVal = mySlider.MinValue;

  • Value

    • mySlider.Value = 3.0;

    • local slideVal = mySlider.Value;

Fields

  • DefaultMaxValue: local defaultMax = mySlider.DefaultMaxValue;

  • DefaultMinValue: local defaultMin = mySlider.DefaultMinValue;

  • DefaultValue: local defaultVal = mySlider.DefaultValue;

Events

  • onValueChanged

    • Inherent variable value

Table

Properties

  • ColumnWidths

    • myTable.ColumnWidths = 0.5;

    • local colWidth = myTable.ColumnWidths;

  • GridLines

    • myTable.GridLines = true;

    • local gridLines = myTable.GridLines;

  • HasHeaderRow: local myTable.HasHeaderRow;

TableData

Properties

  • ColumnSpan

    • myTable.ColumnSpan = 2;

    • local colSpan = myTable.ColumnSpan;

  • RowSpan

    • myTable.RowSpan = 3;

    • local rowSpan = myTable.RowSpan;

TableRow

Properties

  • NumberOfColumns: local colNum = myRow.NumberOfColumns;

TextField/TextInput

Properties

  • PlaceholderText

    • myField.PlaceholderText = "Enter text here...";

    • local phText = myInput.PlaceholderText;

  • Text

    • myInput.Text = "This is text that was input";

    • local inText = myInput.Text;

  • Spelling

Events

  • OnTextChanged

Toggle

Properties

  • Value

    • myToggle.Value = false;

    • local togVal = myToggle.Value;

Methods

  • Toggle: myToggle:Toggle();

Events

  • onValueChanged

Video

Properties

  • Loop

    • myVideo.Loop = true

  • Source

    • myVideo.Source = "resources/newVideo.mp4"

  • Controls Enabled

    • myVideo.ControlsEnabled = false

Methods

  • Play: myVideo:Play()

  • Pause: myVideo:Pause()

  • Stop: myVideo:Stop()

  • SeekToTime: myVideo:SeekToTime(34)

  • SeekToPercent: myVideo:SeekToPercent(0.4)