daily pastebin goal
18%
SHARE
TWEET

helper

a guest Mar 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function containsValue (tab, val)
  2.     for index, value in ipairs(tab) do
  3.         if value == val then
  4.             return true
  5.         end
  6.     end
  7.  
  8.     return false
  9. end
  10.  
  11. function math.clamp(value, low, high)
  12.     return math.min(math.max(value, low), high);
  13. end
  14.  
  15. function string:split(delimiter)
  16.   local result = {};
  17.   local from = 1;
  18.   local delim_from, delim_to = string.find( self, delimiter, from  )
  19.   while delim_from do
  20.     table.insert( result, string.sub( self, from , delim_from-1 ) )
  21.     from  = delim_to + 1
  22.     delim_from, delim_to = string.find( self, delimiter, from  )
  23.   end
  24.   table.insert( result, string.sub( self, from  ) )
  25.   return result
  26. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top