Advertisement
Bolodefchoco_LUAXML

[Biblioteca] Upgrades

Aug 13th, 2015
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.14 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 20/07/2015
  3. --Last update: 14/03/2017
  4. --[[ Notes:
  5.     string.byte
  6.         Does:
  7.             Incrementa o string.byte, retornando o byte de todos os caracteres sem necessidade dos números para verificação.
  8.     math.random
  9.         Does:
  10.             Incrementa o math.random, funcionando normalmente com 1 ou 2 argumentos, mas retorna um argumento entre todos os outros caso haja mais que 2 argumentos (10,20,30 poderá retornar apenas 10 20 e 30)
  11.     table.concat
  12.         Does:
  13.             Incrementa o table.concat, funcionando normalmente, porém com um parâmetro a mais, func(index,value), que permite utilizar os dados repassados pela tabela
  14. ]]--
  15.  
  16.  
  17. do
  18.     local byte = string.byte
  19.     string.byte = function(str)
  20.         return byte(str,1,#str)
  21.     end
  22.  
  23.     local random = math.random
  24.     math.random = function(...)
  25.         local n = {...}
  26.         if #n > 2 then
  27.             return n[random(#n)]
  28.         else
  29.             return random(...)
  30.         end
  31.     end
  32. end
  33.  
  34. table.concat = function(list,sep,f,i,j)
  35.     local txt = ""
  36.     sep = sep or ""
  37.     i,j = i or 1,j or #list
  38.     for k,v in next,list do
  39.         if k >= i and k <= j then
  40.             txt = txt .. (f and f(k,v) or v) .. sep
  41.         end
  42.     end
  43.     return txt:sub(1,-1-#sep)
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement