Notifications
Clear all
[Closed] As the Array can be CustAttribute parameters??
Apr 11, 2012 10:23 am
As the Array can be CustAttribute parameters ??
theCA= attributes theDATA
(
parameters main rollout:rol
(
myArray type:#array ----- ???
)
rollout rol "aaa"
(
)
)
Obviously the above code will ERROR. so how to achieve it ??
2 Replies
Apr 11, 2012 10:23 am
Arrays in parameter blocks are called Tabs. They are statically typed though, so you’ll have to specify something like #IntTab, #StringTab, and so on.
Apr 11, 2012 10:23 am
Or:
(
--based on code by denis Trofimov
fn applyObjectData node theArray:#() = if isvalidnode node do
(
str = "attributes objectData
(
rollout paramsRollout \"Parameters\"
(
dropdownlist nodesDd items:% pos:[0,0]
)
)
"
ss = stringstream ""
format str(with printallelements on theArray as string) to:ss
objectData = execute (ss as string)
free ss
custAttributes.add node objectData baseobject:on
select node --return the node as $
max modify mode -- now the rollout was created the first time
)
local myBox = box(); myBox.name = "theBox"
local myArray = #("test1","test2",(3.14 as string),myBox.name)
applyObjectData myBox theArray:myArray
)
Everything you store in the array will have to be a string, but you can cast the strings back to their original data types, if that information is available.