Bolodefchoco_LUAXML

[String] string.replace

Dec 2nd, 2015
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 02/12/2015
  3. --Last update: 21/05/2016
  4. --[[ Notes:
  5.     Does:
  6.         Substitui em str todos os argumentos em listi para listo
  7.     Args:
  8.         str --> String
  9.         listi --> Tabela com os valores para serem substituidos.
  10.         listo --> Tabela com os valores substitutos.
  11. ]]--
  12.  
  13. string.replace=function(str,listi,listo)
  14.     for k,v in next,listi do
  15.         for i=1,#listo do
  16.             str=str:gsub(k,listo[v])
  17.         end
  18.     end
  19.     return str
  20. end
Advertisement
Add Comment
Please, Sign In to add comment