Lua function returns 768 values - how to put these into a table

Viewed 32

I am programming an instrument that uses Lua with extensions for accessing the instrument controls and displays.

The instrument has a command to read the analyzer plotted points for frequency and amplitude:

:analyzer:trace:frequency?

and

:analyzer:trace:amplitude?

Whenever either of the above is executed, 768 values are returned (frequency or amplitude). This is an embedded test system running Lua for user apps - I can't change the command.

I tried to use table.pack() to put these returned values into a table, but the syntax of the command with the ":" causes an error.

Code I tried --

freq = {};

freq = table.pack(:analyzer:trace:frequency?);

Error message is -- tests.lua:2428: unexpected symbol near ':'

Whenever the :analyzer:trace:frequency? is run stand alone (from PuTTY) or as a line in the Lua code, there is no error.

PuTTY receives 768 frequency values, each separated by a comma.

Looking for ways to direct the return into an array/table or to wrap the command so that it will execute similarly as above.

Thanks

0 Answers
Related