im just having some probs with the gsub function...it works and then it dont...what is going on?
working example:-
function Main()
local sString = "hello #u welcome to: #h!!! Have a nice stay"
local sHubName = "Some Hub"
local sUserName = "someone"
sOut, x = gsub(sString, "#u", sUserName)
sOut, x = gsub(sOut, "#h", sHubName)
SendToAll("heelo", sOut.." - "..x)
end
return == " hello someone welcome to: Some Hub!!! Have a nice stay - 1"
and the one that sometimes works:-
function convertKickString(sIn, kicker, kicked, reason)
sIn, x = gsub(sIn, "#u", kicked.sName)
sIn, x = gsub(sIn, "#e", kicker.sName)
if strfind(sIn, "#r") then sIn, x = gsub(sIn, "#r", reason) end
return sIn
end
any ideas guys?
all good guys...got it all down ;)
-- #u - UserName
-- #h - HubName
-- #e - extra
-- #x - extra
sBot = "BotName"
function Main()
translateString("#u has been kicked by #e because: #x", "somedude", "Corayzon", "get lost man!")
end
function translateString(sString, sUserName, e, x)
-- System Strings
sString, _ = gsub(sString, "#h", frmHub:GetHubName())
-- Input Strings
sString, _ = gsub(sString, "#u", sUserName)
sString, _ = gsub(sString, "#e", e)
sString, _ = gsub(sString, "#x", x)
SendToAll(sBot, sString)
end
8)