switch.lua

Lua implementation of a switch statement

MIT License

Stars
7

switch.lua

Lua implementation of a switch statement. Supports an optional default case.

Example

local switch = require 'switch'

switch('lua', {
  goodbye = function(value)
    ...
  end,
  hello = function(value)
    ...
  end,
  [switch.default] = function(value)
    ...
  end
})