You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’d like to know if using case and switch is possible in LUA -
What is the issue? Include screenshots / videos if possible!
I’m making a plugin that checks lots of values and using lots of if statements can fill the screen and make things look unorganized compared to switch and case -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried to search for solutions on the devforum but couldn’t find anything.
Example of case and switch:
switch (<Expression>) {
// Expression evaluates to a single value.
case <Value1> : //Case is picked when expression gives Value1.
<Statement1>;
<Statement2>;
break;
case <Value2> :
<Statement1>;
<Statement2>;
break;
.
. //So on.
default : // When value of expression didn't match with any case
<Statement1>;
<Statement2>;
break;
}