Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- String com todos os parametros
- -- #123, @um dois tres, !true, ?math.pi
- -- retorna a tabela com os tipos certos
- getWithType = function(a)
- local values = string.split(a or "","[^,]+")
- local out = {}
- for k,v in next,values do
- local icon,value = string.match(v,"([@?#!])(.*)")
- if icon and value then
- if icon == "#" then
- out[#out + 1] = tonumber(value)
- elseif icon == "@" then
- out[#out + 1] = string.trim(tostring(value))
- elseif icon == "!" then
- out[#out + 1] = value == "true"
- elseif icon == "?" then
- out[#out + 1] = system.loadTable(value)
- end
- end
- end
- return out
- end
- tfm.exec.print = function(str) print(str) end
- local f = system.loadTable("tfm.exec.print")
- f = type(f) == "function" and f or tfm.exec.chatMessage
- p = "@teste"
- local args = getWithType(table.concat(p," ",function(k,v)
- return (table.find({"#","@","!","?"},string.sub(v,1,1)) and "," or "") .. v
- end))
- f(table.unpack(args))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement