« Close

Datasheets and User Guides

App Notes

Software & Driver


Lua Scripting

After selecting devices, a tab named "Lua Scripting" is available that lets users write scripts that can be downloaded and executed locally on the T7/T7-Pro. This is a brand new feature available only for the T7 and T7-Pro and its highlighted in its datasheet in the Scripting section.

Key Features
  • A few example scripts for basic Lua programming are included
  • More in-depth and advanced examples included as well
  • Many examples that interface with external sensors via serial (I2C, SPI, UART, etc.)
  • Ability to edit Lua scripts, save them, as well as save to the device
  • Ability to have Lua scripts start running on device power-on
  • Debugging "console" output window to allow for print/printf debugging during run time
  • Basic syntax checking and Lua Syntax highlighting
All of the Lua example programs can be accessed in the Lua code section, however it is recommended to open these files directly in Kipling rather than downloading them off of the website.

Expect to see many new features in this tab in the near future, more examples, etc.

Basic Lua Script Editor
LabJack USB/Ethernet/WiFi DAQ Device Control Program Lua Scripting. Programable Standalone DAQ Device.
Supported Devices

Lua Scripting on T7/T4 Devices

Example Code: Lua Scripting On T7/T4

Lua Scripts run on the device rather than on a computer. This allows for unique control of the T7/T4 device, especially useful in time-sensitive applications, digital communication, and standalone operation applications. A wide variety of detailed examples are available for the best starting place for a given application. Lua scripts can use USER_RAM registers to pass data into other programs, giving it a wide range of use.

Lua scripts are uploaded to the T-series device through Kipling, which makes Lua scripting possible across all platforms (Windows, Mac, and Linux)


The scripting feature is very exciting. It would be even more awesome if one could script using Python, instead of Lua -- thereby using the same code in both autonomous and non-autonomous modes. Will we see Python scripting becoming available on the T7s in the near future?

If you read the Welcome screen in Lua module of Kipling, it explains that the Lua interpreter & compiler are actually ON the T7.  That is, the T7 allocates a significant portion of its memory to storing an eLua interpreter/compiler which accepts plain text input, and compiles it within the T7.  Based on this architecture, it would be impossible to store a Python compiler inside the memory space of the T7's processor.  There are no plans to attempt to store two separate compilers inside the T7.  If you want to code in Python, there might be tools available that will convert python code into Lua code, which you could then paste into the interface in Kipling, and send to the T7.

Would the Lua scripting (or any other functionality) allow the T7 to periodically PUT or POST data to a predefined URL?  Also could it use DNS and DHCP?

The short answer is yes.  The longer answer is that we are in the early stages of testing this capability.  Basically our goal is to make it possible through Lua scripting to post data to cloud services/Internet of Things(IoT) services.  The difficulty has been to decide exactly which services(companies) we want to support, or to just enable low-level access to the Ethernet stack, so users can construct their own strings and parse responses within script.  Exposing the Ethernet stack and allowing users to parse and compose their own strings is the most flexible option, but it would also consume a LOT of script length, with potentially sinister memory/runtime errors.  The other option is to create a few premade functions in firmware that communicate with several different IoT APIs, and limit the options/flexibility.

Do you have a particular cloud/IoT service that you'd like to use?

Is it possible to send a LUA script to a T7 without using Kipling, such as command line?

LabJack Support's picture

That is possible, but it requires writing a sequence of registers. At least one other customer is writing his own script loading routine. I do not believe he has gotten it working yet. If you want to go down this route we can give you instructions.

Yes, I would be interested in the instructions to send lua code to the T7.  In terms of LUA itself, if you are streaming multiple channels in and streaming out long arrays to control multiple channels of an RB12, what is a better rout LUA scripting or stream out?

LabJack Support's picture

Look at the bottom of section 25.0 Scripting in the T7's datasheet. There is a section titled "Load Lua Script Manually To Device".