Lua script plugin type OBS_SOURCE_TYPE_INPUT shown in red on OBS 32

vwout

Member
I've developed a lua script (Control Visca-over-IP based cameras) that appears as INPUT type obs source; it is listed in de sources list of a scene.
Since OBS 32, the script continues to work, but is shown in red in the sources list, just like plugins that cannot be loaded because of incompatibility.

In the log there is no reference of any error or issue with the lua script. I tried changing the output_flags configuration and adding callback functions for get_width, get_height and video_render but this does not have any effect.

How can I find the reason for OBS to render the source in red?
 

DCStrato

Member
I have the same problem with my lua scripts I wrote to control our cameras. They are all red with OBS32 and I can't get them to be a different color. My script renames sources to be more descriptive like "Move TopCamera to Stage" and turns them orange when they are a duplicated source so users know if they change this one they are also going to change the same preset in a different scene. I thought maybe it was that code somehow but this seems to be OBS not happy with the lua script. I will try to download the new source in Visual Studio and step through where the change is happening over the holidays. If I figure something out I will let you know.
 

DCStrato

Member
FYI the original LUA Clock example is also RED as a source. So I expect it has something to do with lua sources interface. I will also try to look/post on Discord and see if there is any mention there.
 

Gondinha

New Member
OBS displays the source in red if the script cannot be loaded. Check if the script is compatible with OBS 32, as the API may have changed. Enable debugging in the OBS log to see more information. Make sure there are no syntax errors in the script and that the get_width, get_height, and video_render functions are working correctly. Also check the output_flags settings and try a simple test script to verify.
 

vwout

Member
Hi all, thanks for the replies. Its encouraging to read that it's not just me ...

I hoped that OBS indeed does complain about the plugin, but it reports it is loaded fine:
Code:
20:06:27.977: [Lua: obs-visca-control.lua] Visca Camera Control version 3.0beta
20:06:27.978: [obs-scripting]: Loaded lua script: obs-visca-control.lua
Besides that, it also is working perfectly fine.
The script is linted (luacheck, lualint), compiled (luajit, luac) and unit-tested without issues.

I do have output flags set, although it's always a bit of a puzzle what is the correct set:
Code:
type = obs.OBS_SOURCE_TYPE_INPUT,
output_flags = bit.bor(obs.OBS_SOURCE_CUSTOM_DRAW),

My script actually doesn't render anything, but regardless of adding get_width, get_height or video_render or not, with a proper response or not, the script continues to run perfectly fine. The only issue: it is shown in red.

@DCStrato I would be curious to learn if VS debugging provides an additional clue. A weak guess is that it is a general compatibility issue with LUA support accidentally introduced with the improved plugin detection since release 31 - but I have no proof.
 

DCStrato

Member
Hi all, thanks for the replies. Its encouraging to read that it's not just me ...

I hoped that OBS indeed does complain about the plugin, but it reports it is loaded fine:
Code:
20:06:27.977: [Lua: obs-visca-control.lua] Visca Camera Control version 3.0beta
20:06:27.978: [obs-scripting]: Loaded lua script: obs-visca-control.lua
Besides that, it also is working perfectly fine.
The script is linted (luacheck, lualint), compiled (luajit, luac) and unit-tested without issues.

I do have output flags set, although it's always a bit of a puzzle what is the correct set:
Code:
type = obs.OBS_SOURCE_TYPE_INPUT,
output_flags = bit.bor(obs.OBS_SOURCE_CUSTOM_DRAW),

My script actually doesn't render anything, but regardless of adding get_width, get_height or video_render or not, with a proper response or not, the script continues to run perfectly fine. The only issue: it is shown in red.

@DCStrato I would be curious to learn if VS debugging provides an additional clue. A weak guess is that it is a general compatibility issue with LUA support accidentally introduced with the improved plugin detection since release 31 - but I have no proof.
Sign up for OBS Discord and under scripting you will see I posted the problem and got a reply that the new version checks for valid sources only during the startup. Scripting alllows for what they are calling "on-the-fly" sources after the startup is complete and get marked as invalid for not matching any of those previously discovered. (as I interpreted the reply). I spun up a VS session with the source and it compiled okay but have not had time to find where to start debugging. OBS is a big product to wrap your head around.
 
Top