Fix 'list' method type and add 'array.size' command
Closed this issue · 0 comments
chros73 commented
Fix 'list' method type: although there was an attempt to deal with 'list' types but it never worked (at least since v0.9.0
).
Now we can create/redefine arrays, even dynamically as well.
Similarly to method.insert.value
method, add the following methods that create public, mutable properties:
method.insert.bool
method.insert.string
method.insert.list
Also add array.size
command: returns the size of a vector.
Examples:
# Defining properties
method.insert = foo1, list, {"x1", "x2", "x3"}
method.insert = foo2, list|private, {10, 20, 30}
method.insert = bar1, list|const,
method.insert = bar2, list
method.insert.list = foo3, {"z1", "z2", "z3"}
# Accessing second element of an array
print=(array.at, (foo1), (value,1))
# Redefine array
foo1.set={1, 2}
# Calculation
print=(math.add, (foo1))
# Size of an array
print=(array.size, (foo1))
# Redefine array dynamically
foo1.set="$d.multicall2=active, cat=$d.state="