Hi there.
As good and handy the Collection Tools in Axy are,
at one point you have to deal with more complex tasks which are easier to do in Lua Script.
Unfortunately there's no Collection Pins available on the Script Compound.
I suspect this is because Axy seems to work internally in 'json style', whereas Lua tables have a different structure.
However... json encoding should be integrated in Lua for LuaJit and/or Lua 5.1 and above.
(If I'm not mistaken, Axy runs LuaJit?)
Trying to use json.encode() however throws an error.
Even when adding dkjson.lua to the libraries won't be of any use, because there's no Collection Pin to get the data out of the Scripting Compound.
Yes. One could use some clever string concatanation and 'roll your own' json which then coul be output as a string. But then again... that's slightly cumbersome :-)
So, long story short, Collection Pins (plus the json library) would awesome in Scripting!
Cheers & all the best.
Eric.
PS: Just stumbled over the idea to:
- add dkjson to Lua
- json.encode the Lua table and output as string
- Save that string via TextExporter Compound as .txt (*not* .json)
- Use another TextFile Compound to bring the text back in
- bring it into Script as String
- json.decode that string into a Lua table
Sort of works.... :-)
Ahhrg.... Just realize that the Script Compound maxes out at 12 Input Pins.... :-(
So it's time for Plan C (or D?)