Reply To: local function?

Home Forums General Programming local function? Reply To: local function?

#83438
human fly
Participant
  • Topics: 124
  • Replies: 1070
  • Total: 1194
  • ★★★★

got it working. so my lengthy thing now looks like:

function padSelect(mod,value)
	-- This variable stops index issues during panel bootup
	if panel:getRestoreState() == true or panel:getProgramState() == true then return end
--	------------------------------------------------------
	local function pselect()	--[ needs (mod,value) in main function ]--
		psub=nil	--[ pad number ]--
		local padName= L(mod:getName())
		psub=tonumber(string.sub(padName,4))
	end
--	------------------------------------------------------
	pselect()	--[ get psub pad# ]--
--	------------------------------------------------------
	findkit()	--[ get kitselct kit# ]--
--	------------------------------------------------------
	kgetcolour()	--[ get kit colours for psetcolour ]--
--	------------------------------------------------------
	findpad()	--[ get padselct pad# ]--
--	------------------------------------------------------
	psetcolour()	--[ set pad colour ]--
--	------------------------------------------------------
	keynumber() 	--[ get keyselct key# ]--
--	------------------------------------------------------
--[ optional: get pad letter and display pad data]--
--	displaypad()
--	------------------------------------------------------
	findVoice()
--	------------------------------------------------------
	updateVoiceName()	--[ get voice name and number ]--
--	--[ retrieve values ]---------------------------------
--	fetchVoiceTable()	--[ restore voice params ]--
--	------------------------------------------------------
--	fetchKeyTable()		--[ restore keyassgn params ]--
--	------------------------------------------------------
end

and the other part that works with it:

function kitSelect(mod,value)
	-- This variable stops index issues during panel bootup
	if panel:getRestoreState() == true or panel:getProgramState() == true then return end
-- ------------------------------------------------------------
	local function kselect()	--[ needs (mod,value) in main function ]--
		ksub=nil	--[ kit number ]--
    	local kitName= L(mod:getName())
		ksub=tonumber(string.sub(kitName,-1)+1)	
		console(String("ksub="..ksub-1))
	end
-- -----------------------------
	kselect()	--[ get ksub ]--
-- -----------------------------
	findkit()	--[ get kitselct ]--
-- -----------------------------
	ksetcolour()
-- -----------------------------
	findpad()		--[ get padselct ]--
-- -----------------------------
	pgetcolour()
-- -----------------------------
	keynumber() --[ get keyselct ]--
-- ------------------------------------------------------------
--[ lcd display ]--	--[ optional ]-- --[ get pad letter ]--
	--panel:getComponent("tempdisplay"):setPropertyString("uiLabelText","key="..keysel)
--	panel:getComponent("tempdisplay2"):setProperty("uiLabelText","pad:"..(tbl_padalpha[pselect]).."/kit:"..(ksub-1).."/key:"..keysel,false)
-- ------------------------------------------------------------
--[ new library stuff ]--
	findVoice()
-- -----------------------------
	updateVoiceName()	--[ get voice name and number ]--
-- -----------------------------
--	fetchVoiceTable()	--[ restore voice params ]--
-- -----------------------------
--	fetchKeyTable()	--[ restore keyassgn params ]--
-- -----------------------------
end
  • This reply was modified 4 years, 1 month ago by human fly. Reason: addendum
Ctrlr