View Single Post
Old 05-10-2019, 09:25 AM   #8
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 301
Default

Quote:
Originally Posted by mespotine View Post
So if I get it right:
No offense, but... No, you don't.

Imagine the attached file (function) from my script, which is just one function. Now, imagine having about 20 or so very similar functions all typed out like that. Now, imagine that starting at line 878 in the attached file I have to modify all of the elseif string.starts from:

Code:
	GUI.Val("Song3Title", 	MkrSegments[2])
	GUI.Val("Song3Singer", 	MkrSegments[3])
to:
Code:
	Song3Title = MkrSegments[2]
	Song3Singer = MkrSegments[3]
and I also need to add into each 'elseif' section:
Code:
	if GUI.Val("Song1Microphone") == "1" then -- Determine Track Group Colors
		GUI.elms.Song1StartButton.col_fill = "brown"
	elseif GUI.Val("Song1Microphone") == "2" then
		GUI.elms.Song1StartButton.col_fill = "red"
	elseif GUI.Val("Song1Microphone") == "3" then
		GUI.elms.Song1StartButton.col_fill = "orange"
	elseif GUI.Val("Song1Microphone") == "4" then
		GUI.elms.Song1StartButton.col_fill = "yellow"
	elseif GUI.Val("Song1Microphone") == "5" then
		GUI.elms.Song1StartButton.col_fill = "green"
	elseif GUI.Val("Song1Microphone") == "6" then
		GUI.elms.Song1StartButton.col_fill = "blue"
	elseif GUI.Val("Song1Microphone") == "7" then
		GUI.elms.Song1StartButton.col_fill = "violet"
	elseif GUI.Val("Song1Microphone") == "8" then
		GUI.elms.Song1StartButton.col_fill = "gray"
	elseif GUI.Val("Song1Microphone") == "9" then
		GUI.elms.Song1StartButton.col_fill = "white"
	else
		GUI.elms.Song1StartButton.col_fill = "elm_frame"
	end
	if GUI.Val("Tracks") == "1" then ..........
Now, imagine having to modify several of the other extremely long functions.

What I'm trying to do is to shorten the amount of typing involved in creating / modifying these highly repetitive-like yet very long functions. Also known as 'short-hand', or 'short-handing' (or if you will, 'short-cutting').

It would certainly be nice if I could replace the common numeral (1-200) with a variable and loop through each 'elseif' section.
Attached Files
File Type: lua function ScanMarkers().lua (127.8 KB, 8 views)
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote