Suslik V
Active Member
In the example:
there is code:
Questions:
Wiki - Scripting Tutorial Halftone Filter Listing | OBS
Complete source code of the [Scripting Tutorial Halftone Filter](Scripting-Tutorial-Halftone-Filter). ## First part In the first part, a minimal video effect is proposed. Use it …
obsproject.com
Lua:
...
-- Calls the destroy function if the effect was not compiled properly
if data.effect == nil then
obs.blog(obs.LOG_ERROR, "Effect compilation failed for " .. effect_file_path)
source_info.destroy(data) -- FOR WHAT REASON?
return nil
end
...
-- Destroys and release resources linked to the custom data
source_info.destroy = function(data)
if data.effect ~= nil then
obs.obs_enter_graphics()
obs.gs_effect_destroy(data.effect)
data.effect = nil -- IS IT NEEDED AT ALL?
obs.obs_leave_graphics()
end
end
...
Questions:
- What
source_info.destroy(data)
is doing here while there is null check present in the destroy itselfif data.effect ~= nil
? - Does the
data.effect = nil
required in the destroy (for this script and in general)?