-
Автор темы
- #1
Не могу понять, почему визибилити не работает для цикла в цикле. Подскажите, пожалуйста, что не так я делаю.
Код:
local ui = ui.create("main")
all_conditions = {"Standing", "Running", "Walking"}
local condition = ui:combo("Condition", all_conditions)
local aa_cond = {}
local ab_cond = {}
for z, x in pairs(all_conditions) do
aa_cond[z] = {}
aa_cond[z].switch = ui:switch("Enable "..all_conditions[z])
aa_cond[z].slider = ui:slider("Yaw "..all_conditions[z], -180, 180, 1)
aa_cond[z].ab_switch = ui:switch("Enable AB "..all_conditions[z])
aa_cond[z].create = aa_cond[z].ab_switch:create()
aa_cond[z].phase = ui:slider("Max Phases", 1, 5, 1)
for k = 1, 5 do
ab_cond[k] = {}
ab_cond[k].label = ui:label(all_conditions[z].." Phase #"..k)
ab_cond[k].create = ab_cond[k].label:create()
ab_cond[k].slider = ab_cond[k].create:slider("Desync", -180, 180, 1)
end
end
local function visibility()
for z, x in pairs(all_conditions) do
current_cond = condition:get() == all_conditions[z]
aa_cond[z].switch:visibility(current_cond)
aa_cond[z].slider:visibility(current_cond)
aa_cond[z].ab_switch:visibility(current_cond)
aa_cond[z].phase:visibility(current_cond)
check_brute = aa_cond[z].ab_switch:get()
for k = 1, 5 do
ab_cond[k].label:visibility(false)
ab_cond[k].slider:visibility(false)
end
end
end
events.render:set(visibility)