Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 28/03/2016
- --Last update: 26/05/2016
- --[[ Notes:
- Does:
- Retorna a cadeia de words palavras pulando as palavras de jump
- Args:
- str --> String
- words --> Deve ser um número inteiro para a quantidade de palavras da string retornada
- jump --> Deve ser uma tabela com todas as palavras de str para serem puladas
- ]]--
- string.jump=function(str,words,jump)
- str,words,jump = str or "",tonumber(words) or #str,(jump ~= nil and (type(jump) ~= "table" and {jump} or jump) or {" "})
- local newString,jumped,rest = {},0,0
- for value in str:gmatch("[^%s]+") do
- local bool = true
- for k,v in next,jump do if v == value then bool = false;jumped=jumped+1 end end
- if bool then if #newString+1 <= words then table.insert(newString,value) else rest=rest+1 end end
- end
- return table.concat(newString," "),jumped,rest
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement