Lua Script Debugger | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


Lua Script Debugger

After selecting devices, a tab named "Lua Scripting" is available. It is used to write and debug scripts that execute on-board T-Series devices. Details about Lua scripting are in the device datasheet Lua Scripting section.

Key Features
  • Includes basic and advanced Lua examples
  • 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 examples can be accessed in the Lua code section, but it's easier to open and run them directly in Kipling.

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


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".

Is this functionality still available? to send a LUA script via command line or  python?

labjack support's picture

The section "Load Lua Script Manually To Device" on the Lua scripting page got deleted. I've added it back. Using the code in that section, you can implement a Python LJM program that loads a script to the device. If you'd like us to add a Python example that does this, please email us at [email protected].