November 12, 2017 at 7:45 am #73487
(before i check this out)
if i put a function inside a method, does have a ‘local’ status?
or will it have the same action (or a conflict) if i use the same
function name in another ‘twin’ method, doing the same thing to
or can i specify that a function is local?
structure12 = function (--mod, --value) -- sets corresponding option views local structure = panel:getModulatorByName("struct12_pt1"):getValue() local SynPcm1 = panel:getComponent("tabs_SynPcm1_pt1") local SynPcm2 = panel:getComponent("tabs_SynPcm2_pt1") -- function see00() SynPcm1:setPropertyInt("uiTabsCurrentTab", 0) SynPcm2:setPropertyInt("uiTabsCurrentTab", 0) end if structure == 0 then see00() end end
and then, i would want to use the same code, with a method
called ‘structure34’, addressing similarly named modulators
and components, but with names suffixed 3/4 instead of 1/2,
and keep the same ‘sub’-function names. or would these have
to now have unique names too?
ie: once created, do they remain in memory everywhere else
in the panel, ready to be called? or do they exist only for
that method?November 12, 2017 at 8:08 am #73488
No it’s not local. Everything is global by default. You need to use local before a variable if you want it defined locally. Not sure if you can make methods local.
http://godlike.com.auNovember 12, 2017 at 8:13 am #73489
(answering own post..)
well, it seems ok if i just copy the whole thing and amend
suppose if i had created them externally in a ‘library’ method,
and called them from there, there would be an issue (and functions
would have to check which modulators+components to act on).November 12, 2017 at 11:58 am #73492
hi Puppeteer, missed your post.
as i said, it seems ok, repeating the same function/s identically
within a method –see00(), see01(), see10(), see11()–
i called them that to indicate which of 2 tabs were showing for
2 uiTabs. and in each method, they are addressing different
uitabs (synPcm1+2 pair, and synPcm3+4 pair).
so i can put ‘local ‘ in front of a ‘sub’-function ?
done now, and seems to be ok, so i’m leaving it like that for now.
(as i may end up later with 8 parts, and thus 8x everything – which
i can avoid once i work it out, no doubt – it makes it easier if
i can just rename the declarations at the top and leave the rest
as is (this optimises a couple of methods a lot already).
You must be logged in to reply to this topic.