PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Help with scripts => Topic started by: ?StIfFLEr?? on 24 April, 2009, 07:06:11

Title: Need help
Post by: ?StIfFLEr?? on 24 April, 2009, 07:06:11
Can anyone help me understand the strings of lua.
Like example what does this stands for i am not able to get "(Data, "%b<>%s(%S+)%s+(%S+)|")"
Title: Re: Need help
Post by: Madman on 24 April, 2009, 20:40:34
Well, I asume that this line is found in ChatArrival.
_,_,A,B = string.find(Data, "%b<>%s(%S+)%s+(%S+)|")
%b<> is anything between <>, this would be the nick of the user sending the chat
%s is a space, %s+ is one space or more.
%S+ is anything else then space.
| (endpipe) is the end of the incomming data/line

So the statemet would only be correct if someone wrote something like this:
test this
nice string
catch me
!cmd arg

A would be test,nice,catch or !cmd
B would be this,string,me or arg

It would fail on
!test arg1 arg2
this is my text
Title: Re: Need help
Post by: ?StIfFLEr?? on 25 April, 2009, 06:02:46
Thanks Mutor and madman you both are just awesome.
Sorry for not posting the full script because it did not had any credits in it ..
So i thought it would be wrong in posting that script here.
I was trying to learn through your and madman's script and understanding them but comparing it with other scripts.
I know it sounds ridiculous but it made me learn a bit of it will surely look forward to the link you provided mutor.
Thanks a Lot mutor and madman you both have been a great help in learning whatever i have learnt so far.