Scripting

Search The Documentation:

  1. Home
  2. Docs
  3. Scripting
  4. Script Lifecycle
  5. LUA Basics

LUA Basics

Although there are plenty of better tutorials out there online, this is a sort of “cheat sheet” for coding that may still help even if you have had experience with another coding language before

  • Artspark’s inner engine functionality is wrapped under a single object simply called “obj
  • Comments are lines of text that you can write in a script for others to better understand the code
    –This is a comment

  • If / Then / Else
    if value == value2 then
    –Do something when it matches
    else
    –Do something else
    end

  • Joining strings together
    • “this” .. ‘and’ .. “that”
  • Passing multiple variables or lines of code as strings
    • Escape the LUA script similar to Javascript
    • Otherwise, you can store the string using a block of text in LUA formatting:
      scriptAsString = [[
      function testFunction()
      obj.set3DText(“Test”)
      end

      ]]
  • Optional values can be ignored entirely, either skipped with an empty value or left off the end of a command
Tags
Was this article helpful to you? Yes No

How can we help?