-
-
Notifications
You must be signed in to change notification settings - Fork 5
ObjectList
Anthony Headley edited this page Jan 17, 2022
·
2 revisions
Object list is a helpful function that will return a table of objects of the requested type. The input for the function is a tring that seems to parse the like the command line entry. For example if you want some fixtures returned you can do something like Fixture 1 Thru 1
or Fixture 1 + 3 + 5
The return type is always a table, unless you supply a nil input string. The length of the string is the number of objects returned and you can use the ::v:GetClass
method to find out what type of object it is.
Name | Type | Description | Optional |
---|---|---|---|
Input | string | Command Line of objects to return |
Type | Description |
---|---|
table or nil | table of UserData Objects. Only returns nil if a nil input sent, otherwise returns a 0 length table for invalid requests |
function ReturnData (RequestString)
local n = 0
Printf("Count of Objects " .. #ObjectList(RequestString))
-- loop through all the returned values
for k, v in ipairs(ObjectList(RequestString)) do
-- for all object return the name field
Printf("Name: " .. v.name or "nil")
-- if a fixture object also return the patch field
if v:GetClass() == "Fixture" then
Printf("Patch: " .. v.patch or "nil") -- return the fixtures patch value
-- if a sequence object return the autostart value as a string
elseif v:GetClass() == "Sequence" then
local autostartEnabled = "False"
if v.autostart then
autostartEnabled = "True"
end
Printf("AutoStart: " .. autostartEnabled) -- returns if autostart is set
end
Printf("----------")
end
end
function Main ()
ReturnData("Fixture 1 Thru 10") -- ask for some fixtures
ReturnData("Seq thru") -- ask for all sequences
end
return Main