I made this switch function where there are two ways of implementing it, the code and example can be found below.

switch.lua

--[[
	Author: Colton Tipton
]]
switch = function(x, ...) -- x: (string, int, boolean), args
	
	local args = ...
	
	return function(t)
		
		if t and type(t) == "table" then
			for k, v in pairs(t) do
				
				print(k, x, v)
				if k == x then
					if type(v) == "function" then
						return v(args)
					end
					return v
				end
				
			end
		end
		
		return function(z)
			
			if x == z then
				return true
			end
			
			return false
			
		end
		
	end
	
end

return switch

server.lua

--[[
	Author: Colton Tipton
]]

local switch = require('switch.lua')

switch("pow", 4){
	
	[1] = "hello",
	["pow"] = function(x) print(x) return x^2  end,
	[5] = {
		
	}
	
}

for case in switch(3) do
	
	if case(1) then
		print(1)
	elseif case(2) then
		print(2)
		break
	elseif case(3) then
		print(3)
		break
	else
		-- default
		break
	end
	
end

Please leave a comment below, and let me know what you think!