jalovatt / scythe

Lua GUI library and utility framework for Reaper scripts (formerly Lokasenna_GUI)
https://jalovatt.github.io/scythe
MIT License
26 stars 6 forks source link

Move guard clauses inside functions #92

Closed jalovatt closed 5 years ago

jalovatt commented 5 years ago

For readability, things like:

if self.caption and self.caption ~= "" then self:drawcaption() end
...
function thisElement:drawcaption()

should be checked inside the function instead:

self:drawcaption()
...
function thisElement:drawcaption()
  if not self.caption or self.caption == "" then return end

Technically there's a slight performance cost from the added function call, but that can be worried about if and when it becomes a problem.