Forum

> > CS2D > Scripts > Is there a switch like function in Lua?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Is there a switch like function in Lua?

2 replies
To the start Previous 1 Next To the start

old Is there a switch like function in Lua?

DannyDeth
User Off Offline

Quote
Well, I would like to know if there was a function similar to the "switch" from C:
1
2
3
4
5
switch(variable) {
	case 1: printf("1\n"); break;
	case 2: printf("2\n"); break;
	case default: printf("Not one or two\b"); break;
}
Well, not tht exactly but something similar, I'm tired of using a continous line of if statements to test the same varibable
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview