containing variables in tables

Hello everyone,

 

I am creating an app with a plugin for photoshop kwiksher (Lua based).

 

On one page I have 25 objects that can be dragged. Once the objects have been put in their places an animation is activated. The problem is that when I try to create the 25 variables an error message appears saying “more than 60 upvalues”.

 

If, instead of using 25 objects I use 10, everything works just fine and the animation is activated when the objects are placed correctly. The error message comes up after the 10th variable.

 

I have been searching on the internet and it seems like the solution to this is to put the variables in a table. Kwik has the option of doing this but I’m not able to configure it properly. On the Official Training, in the variables section, Alex says that he won’t explain the tables because they are too complex.

 

I have been trying to solve this problem for a few days now but I’m unable to reach a solution. Can someone tell me how to put the variables in a table to then be able to add the +1 value when the object is put in its place so that the animation is activated once all of them have been placed correctly?

 

Thanks!

Lua has a limit to the number of distinct variables you can use per file. So you’ll want to use tables to compact things a bit, or contain some of your variables as locals within functions. 

I have no idea how kwiksher works, but a table works like this:

local myList = {} -- This creates a table index that is always +1 the length of the table myList[#myList+1] = "hi" -- You can also do this. It's unordered but easy myList.bob = "hi to you too" myList.hungry = 44 myList.gunType = "LASERZ"

Lua has a limit to the number of distinct variables you can use per file. So you’ll want to use tables to compact things a bit, or contain some of your variables as locals within functions. 

I have no idea how kwiksher works, but a table works like this:

local myList = {} -- This creates a table index that is always +1 the length of the table myList[#myList+1] = "hi" -- You can also do this. It's unordered but easy myList.bob = "hi to you too" myList.hungry = 44 myList.gunType = "LASERZ"