Boxing Arrays

Monkey Forums/Monkey Programming/Boxing Arrays

Rhodesy(Posted 2012) [#1]
I come from a JavaScript background, and doing something like this is quite normal...

array = [val1,val2,val3,[subarray1,subarray2],val4]


I know in Monkey I can do...

Local array:Object[] = [BoxInt(2),BoxString("hello"), ... ] with a 1D array...

..but If i want to include an array in an array, is it possible to Box it like I can do Int's, String's, Float's ?


zoqfotpik(Posted 2012) [#2]
I don't see why not. I have some rather complex data structures boxed up. One of them is a data structure for particles that includes numerous arrays.


jpoag(Posted 2012) [#3]
See ArrayObject in "monkey/modules/monkey/boxes.monkey"

Boxes.monkey has all the boxes for the base types.