PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: blackwings on 05 October, 2004, 13:44:53

Title: return a text from DataArrival
Post by: blackwings on 05 October, 2004, 13:44:53
Hi, I need some help here.
I have tried to learn some LUA and I'm still a huge newbie.

What I'm trying to do is to send a text to the variable(or whatever it called) client, which I later on will use in a text message like this =
user:SendData(Bot,"Message"..client..".")

I probably made a huge mistake, but whats wrong with my DataArrival ?

client=""

function DataArrival( user , data )
    if strsub(data, 1,3) == "<++" then
      Client=="Original DC++"
      return 1
    elsif strsub(data, 1,2) == "<0" then
      Client="oDC"
      return 1
    end
end
Title:
Post by: bastya_elvtars on 05 October, 2004, 14:07:44
simplest way to do:

Client=""


function DataArrival( user , data ) -- when a data arrives
if strsub(data, 1, 7) == "$MyINFO" then -- check if its a myinfo string, and if so then
if strfind(data, "<++") then -- if this found, then
Client=="Original DC++"
elseif strfind(data, " Client="oDC"
end
end
end

Beawre: Client and client arent the same variables, as LUA is case sensitive.