# OBS Lua - Scene Item to Source



## Alexik (Jun 26, 2020)

I need to get a list of sources of needed scene, but i only found the way to get a list of obs_scene_item objects. How to take the obs_source objects from them?


----------



## mball2301 (Jun 26, 2020)

I have not gotten my script to work yet (frontend call issue).  But I would think the function:
obs_sceneitem_get_source(scene_item) would get you there.

This would be in a for loop to iterate the scene items (i.e for _, scene_item in ipairs(scene_items) do)


----------



## Alexik (Jun 27, 2020)

mball2301 said:


> I have not gotten my script to work yet (frontend call issue).  But I would think the function:
> obs_sceneitem_get_source(scene_item) would get you there.
> 
> This would be in a for loop to iterate the scene items (i.e for _, scene_item in ipairs(scene_items) do)


Yesterday it took about 4 hours for me to look for this method and i didn't find it. I was sure i fully researched the https://obsproject.com/docs/reference-scenes.html page but now i see this method is there right under obs_sceneitem_get_scene which i saw. Thanks a lot.


----------



## Alexik (Jun 27, 2020)

I made for myself a method which reloads browsers on chosen scene so use it if u need - https://obsproject.com/forum/resources/scene-browsers-refresh.1025/


----------



## mball2301 (Jun 30, 2020)

Thanks for your help.  With your help I was able to get my script going.  I still have somewhere that I am not releasing objects so I show memory leaks.  Do you know the best way to correct this?


----------



## EmbodyWisdomToday (Aug 16, 2020)

Have you tried 
*obs.obs_source_release(source)*, 
where 
*local source = obs.obs_get_source_by_name(source_name)*?


----------

