Posted Mon, 18 Sep 2023 13:21:48 GMT by Hubbell, Ed
Can anyone offer any guidance on what version of Lua I should work with on my PC that will successfully install on a 2612B? I tried using a state machine library that used the Lua argument syntax of ... - The Keithley unit didn't seem to like that. Not sure if Lua 3 or 4 or 5 is the right version to use as a test bed. 

Hoping my client can get me a Keithley to bring home and test with. I feel like I'm flying blind trying to work on these scripts from the office. 

If anyone had a Lua class laying around that mirrored the available commands for the 2600 series, that'd probably help. I haven't seen anything like that in my internet travels. 

~Ed
Posted Fri, 22 Sep 2023 17:23:57 GMT by Odhner, Bradley
The 2612B already has Lua installed on it through the Test Script engine, you won't need to/be able to install anything on it, just add and run TSP scripts.

The TSP language is based on Lua 5.0 with a fair number of restrictions to prevent interference with the instrument operation, and custom libraries to facilitate instrument control.

There isn't a test bed that mirrors the 2600B engine (that I know of). You have the Reference Manual though, yes? https://www.tek.com/en/keithley-source-measure-units/smu-2600b-series-sourcemeter-manual-8
That details all the custom commands and covers the most common structures in Lua available.

If you're doing something more complex, I'd recommend the Lua 5.0 documentation. Many of the more complex features are functional on the 2600Bs, but libraries like io, os, and the C API will usually return errors.
Posted Fri, 29 Sep 2023 00:42:39 GMT by Hubbell, Ed
Thanks - I wasn't trying to install anything, I was trying to use some Lua code that uses the ... notation for a variable number of arguments. They Keithley didn't like that, so I'm guessing that must be one of the restrictions in place on the Keithley. 

https://github.com/kyleconroy/lua-state-machine/blob/master/statemachine.lua

>If you're doing something more complex,

The problem is that the tsp script I inherited was over 10K lines long. Add to that going from a single to dual SMU unit and going from 3 tspnet nodes to 0, there were a lot of script edits just due to hardware changes. I've got the line count down to a more manageable 4K or so now. 

Thanks for the help -
~Ed
Posted Tue, 03 Oct 2023 18:43:19 GMT by Odhner, Bradley

The 2612B and Lua 5.0 do support the '...' notation for vararg functions, though it works differently than in Lua 5.1. This is called out in the 5.1 documentation: https://www.lua.org/manual/5.1/manual.html#7.1 and described in the 5.0 docs: https://www.lua.org/manual/5.0/manual.html#2.5.8

I see that state machine code was written for Lua 5.1, so if you're using it directly that would be at least one of the reasons it's not working. Unfortunately I'm only familiar with Lua for TSP, but a dedicated Lua forum might help more if you're trying to adapt 5.1 to 5.0 script.

Always fun adapting other people's code! Let me know if you run into other issues.

You must be signed in to post in this forum.