説明
The GetPresetData Lua function returns a table with the preset data based on the preset handle.
The returned table is quite complex and has tables inside the table.
引数
- handle:
The handle of the preset from which the data will be collected.
- boolean | nil (オプション):
This boolean determines whether the returned table should only contain phaser data.
The default value is "false".
- boolean (オプション):
This boolean defines if there should be an extra object in the returned table. The default value is "true". The extra table object has the key "by_fixtures", and it contains the same table content as the returned table, but the keys are the fixture ID number instead of the UI Channel Index.
戻り値
- table | nil:
The returned table contains the preset data. It has multiple levels of tables.
例
This example prints information about the first level table in the preset data and the first level of the first fixture in the preset.
It uses dimmer preset 1, which must exist.
|
return function() local myPreset = DataPool().PresetPools[1][1] local myPresetData = GetPresetData(myPreset, false, false) if myPresetData == nil then ErrPrintf("Dimmer preset 1 does not exist. Please create one and try again.") return end
for Key, value in pairs(myPresetData) do if type(value) == "table" then Printf("Key: " .. Key .. " ; Value type is: " .. type(value)) else Printf("Key: " .. Key .. " ; Value type is: " .. type(value) .. " ; Value: " .. value) end end
local myIntegerTableKeys = {} for key,_ in pairs(myPresetData) do if type(key) == "number" then table.insert(myIntegerTableKeys, key) end end table.sort(myIntegerTableKeys)
local tableIndex = myIntegerTableKeys[1] if tableIndex ~= nil then Printf("=============== TABLE CONTENT START - Table Key: " .. tableIndex .." ===============") for Key, value in pairs(myPresetData[tableIndex]) do if type(value) == "table" then Printf("Key: " .. Key .. " ; Value type is: " .. type(value)) else Printf("Key: " .. Key .. " ; Value type is: " .. type(value) .. " ; Value: " .. tostring(value)) end end Printf("================ TABLE CONTENT END - Table Key: " .. tableIndex .." ================") end end |