obs = obslua
-- Define a function that updates the stream key from the input field
function update_stream_key(props, p)
local new_stream_key = obs.obs_properties_get_string(props.stream_key)
local settings = obs.obs_data_create()
obs.obs_data_set_string(settings, "key", new_stream_key)
obs.obs_frontend_update_streaming_settings(settings)
obs.obs_data_release(settings)
end
-- Define the properties for the input field and button
function myplugin_properties(props)
local p = obs.obs_properties_create()
-- Add a group to the properties
local group = obs.obs_properties_add_group(p, "stream_key_group", "Stream Key", obs.OBS_GROUP_NORMAL)
-- Add the input field to the group
obs.obs_properties_add_text(group, "stream_key", "Stream Key", obs.OBS_TEXT_DEFAULT)
-- Add the update button to the group
obs.obs_properties_add_button(group, "update_button", "Update Stream Key", update_stream_key)
return p
end
-- Define the dock widget
function myplugin_dock_widget(widget, container)
local props = obs.obs_properties_create()
obs.obs_properties_add_extern(props, "myplugin", "My Plugin")
local p = obs.obs_properties_create()
obs.obs_properties_add_list(p, "plugins", "Plugins", obs.OBS_COMBO_TYPE_LIST, obs.OBS_COMBO_FORMAT_STRING)
-- Set the properties for the dock widget
obs.obs_dock_widget_set_properties(widget, props)
obs.obs_dock_widget_set_title(widget, "My Plugin")
obs.obs_dock_widget_set_icon(widget, "icon.png")
obs.obs_properties_release(props)
obs.obs_properties_release(p)
end
-- Register the properties and dock widget with OBS
obs.obs_properties_add_extern("myplugin", "My Plugin", myplugin_properties)
obs.obs_frontend_add_dock_widget("myplugin", "My Plugin", myplugin_dock_widget)