改进 OBS 中的 countdown.lua 以在计时器完成时更改场景

Improve countdown.lua in OBS to change scenes when timer complete

我想出了如何在 countdown.lua 中添加和填充场景下拉列表,并且我看到了将切换场景的代码放在哪里。如何使用 lua 在 OBS 中更改场景?包含所选目标场景的下拉菜单称为 next_scene.

function set_time_text()
    ...
    if cur_seconds < 1 then
        --# BJS goto scene stored in field "next_scene"
    end
...
function script_properties
...
    local t = obs.obs_properties_add_list(props, "next_scene", "Next Scene", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
    local scenes = obs.obs_frontend_get_scene_names()
    if scenes ~= nil then
        for _, scene in ipairs(scenes) do
            obs.obs_property_list_add_string(t, scene, scene)
        end
    end
function set_time_text()
        ....
        if cur_seconds < 1 then
        if next_scene ~= "" and next_scene ~= "-----" then
            local source = obs.obs_get_source_by_name(next_scene)
            obs.obs_source_release(source)
            obs.obs_frontend_set_current_scene(source)
        else
            text = stop_text
        end
    end