Jump to content

Switch / Case in lua


Recommended Posts

Technically, you can also assign anonymous functions to a table and call it with your "switch" value as an index.

However, depending on how many possibilities there are, you may be better off with simple if/elseif/else constructs as 50p says. if there are only 4-5 possibilities, a table with functions would be kinda overkill.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...