I have a question about objects. I get to the Methods via object:method. How can I reach the properties from outside, also with : ? Doesn’t work. Or do I have to write a method/function for each var to give ist Out?
Can I have an Array of objects and use append array, object? How do I get the properties then?
Methods are stored the same way. However, by using : instead of . you automatically pass the parameter “self” as its first argument.
The following lines are equivalent:
You can have arrays of anything. arrays are also just tables in lua/codea.
Arrays are implemented by tables with an integer as a key, instead of a name.
Take care with the use of ipairs and pairs, and the #object command.
Accessing values in an “array” is exactly the same as above.
It’s even possible to have arrays of objects holding other arrays and methods.
That should work. It will add an instance of RecordMove to the movesList table at the first available spot in the array. Insert will search the table for the first integer index for which movesList[i] = nil. Great for stack implementations.