If I need to use an array in an ofelia script, what is the best way?
Lua tutorials tell me that you need to start with an empty array or array literal, enclosed in curly braces. Fair enough.
If I type M.array = {}
into an object box, the PD GUI chokes on it and says "keycode 123: dropped."
If I create [ofelia f blahblah]
, exit edit mode, click on the box to open the text window, put in some code, close the window, and save the patch, the code does not get saved.
I was able to get it to work by writing the script in an external file and [read ...(
-ing it into an [ofelia d]
object. (Now the .pd file is no longer self-contained.)
I'm OK with that for my own use, but within a few months, I will need to sell that to some students. "You can write a simple script directly into the object, but... oh no wait, if you use arrays, then you have to walk around the block first."
Or is there another Lua syntax for arrays? Just wondering how this is handled.
hjh