[Feature Request] Collection Pin on Script Compound


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.


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.... :-)


Profile Image

Ahhrg.... Just realize that the Script Compound maxes out at 12 Input Pins.... :-(
So it's time for Plan C (or D?)

Profile Image

How do you add external libraries to Lua in Aximmetry?


local json = require ("dkjson")  

for example?

Do you download it and add the library somewhere?

Profile Image

Hi Buffos.

First, get dkjson.lua from http://dkolf.de/src/dkjson-lua.fsl/home

Then, put it into Axy's Lua Folder (like [..]\Aximmetry\resources\plugin\lua)

After that it should work just fine when doing local json = require ("dkjson")

Profile Image


Thank you :)

Profile Image


We added the Collection data type for Script compound to our request list and we will consider adding it in future releases.

Warmest regards,

Profile Image


One thing to keep in mind though when using dkjson (or other json coders for Lua):
While Json and Lua support both Integer and String Keys like: {1:"Some Information 1"} and {"1":"Some Information 2"} within the same table/array
integer Keys are converted to String when doing json.encode()

So when you generate your table in Lua with integer keys, export to json, import again into Lua and modify the table
then export again to Json, you will end up with double (and hence invalid) K/V pairs.

So make sure to index your Lua tables with String Keys in the first place.
Like myTable[tostring(incomingIndex)]={'Some Information'}