function changeSourceSetting( source, settingKey , settingValue , settingType )
local wasValue = ""
if settingType == "string" or settingType == "int" or settingType == "bool" or settingType == "double" then
local srcObj = obs.obs_get_source_by_name( source ) -- getObj srcObj
if srcObj ~= nil then
local curSettings = obs.obs_source_get_settings( srcObj ) -- getObj curSettings
if settingType == "string" then wasValue = obs.obs_data_get_string( curSettings , settingKey ) end
if settingType == "int" then wasValue = obs.obs_data_get_int ( curSettings , settingKey ) end
if settingType == "bool" then wasValue = obs.obs_data_get_bool ( curSettings , settingKey ) end
if settingType == "double" then wasValue = obs.obs_data_get_double( curSettings , settingKey ) end
-- update the settings via given key/value
if settingType == "string" then obs.obs_data_set_string( curSettings , settingKey, settingValue ) end
if settingType == "int" then obs.obs_data_set_int ( curSettings , settingKey, settingValue ) end
if settingType == "bool" then obs.obs_data_set_bool ( curSettings , settingKey, settingValue ) end
if settingType == "double" then obs.obs_data_set_double( curSettings , settingKey, settingValue ) end
obs.obs_source_update(srcObj, curSettings)
obs.obs_data_release(curSettings) -- release curSettings
obs.obs_source_release(srcObj) -- release srcObj
else
print("changeSourceSetting - Requested SourceObj Not Found for: "..source )
end
else
print( "changeSourceSetting - Requested settingType invalid: "..settingType )
end
return wasValue
end