How do I retrieve the values from an editable list in a Lua script?

lgulyas

New Member
Hi all,

I'm trying to write a script that will cycle through a list of URLs input by the user. I'm using an editable list, created in the script_properties() function, like this:

local p_url_list = obs.obs_properties_add_editable_list(props, "url_list", "URLs", obs.OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS, "", "")

It works fine, in so far as the list is displayed, and I can add URLs to it. But for the life of me, I can't figure out how to retrieve the values from the list.
Help!?
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
You'd want to read the settings, not the property, if that makes sense. There's two different things: properties, and settings. Properties are used to create UI widgets, and then the settings are the actual values shown in those properties and edited by those properties. So you want to get the settings to read the value associated with a property, if that makes sense. so in that case, if it's "url_list", you would get the "url_list" setting. It's going to be an array, so you'd want to use array = obs.obs_data_get_array(settings, "url_list"). Hopefully I'm making sense.
 

lgulyas

New Member
You'd want to read the settings, not the property, if that makes sense. There's two different things: properties, and settings. Properties are used to create UI widgets, and then the settings are the actual values shown in those properties and edited by those properties. So you want to get the settings to read the value associated with a property, if that makes sense. so in that case, if it's "url_list", you would get the "url_list" setting. It's going to be an array, so you'd want to use array = obs.obs_data_get_array(settings, "url_list"). Hopefully I'm making sense.
That did the trick. Thanks.
 
Top