Last active
March 21, 2017 10:59
-
-
Save mattkrins/0d39939f6a881867f5d74df7f72d8a17 to your computer and use it in GitHub Desktop.
A Garry's Mod Switch Statement helper function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local s function switch(v) s = v or false return s end | |
function case(v, yes, no) if s and v and (v==s) then if yes then return yes(s, v) end return true end if no then return no(s, v) end return false end | |
function clearSwitch() s=nil return true end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
Example:
Result: