In the example:
there is code:
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 …
... -- 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 ...
source_info.destroy(data)is doing here while there is null check present in the destroy itself
if data.effect ~= nil?
- Does the
data.effect = nilrequired in the destroy (for this script and in general)?