PtokaX forum

Development Section => Your Developing Problems => Topic started by: kepp on 10 December, 2003, 20:16:38

Title: Problem with gsub, < Characters>
Post by: kepp on 10 December, 2003, 20:16:38
I want to do something like this


function DataArrival(user, data)
    if (strsub(data,1,1) == "<") or (strsub(data,1,4) == "$To:") then
          data=strsub(data,1,strlen(data)-1)

          local _,_,arg = strfind(data,"%b<>(.*)")

          if arg ~= nil then
arg = gsub(arg, "(%a)", "%1-%1")

                                           SendToAll(user.sName, arg) return 1
                                  end
                      end
          end

But im having a hard time Testing/Changing these:
"(%a)", "%1-%1")

What i don't understand is What "%1%2" does
Yea sure, i can see changes when i try other numbers...
But what exactly is it doing?
and also, if i would like to change the arg to UpperCase and lowercase letters,

Etc: HeLlO

If that is too hard to explain then just leave it, all i wanna know is what %2%1 does for inst
Title:
Post by: c h i l l a on 11 December, 2003, 21:15:16
kepp you can search the LUA reference manual..  and you can look at this script made by plop
zcrazy (http://217.120.180.188/Forum4/redirect.php?dlid=32&PHPSESSID=0bf5be5f540fad31690c72b579b9d826)

whitch should actually, be in the finished scripts section..
really a cool way of holding functions. and only usiing one string arrival..  I think I can use this :))
Title:
Post by: kepp on 12 December, 2003, 02:02:02
Oh, forgot about that one :) i'l take a look there to see if i get it!!
Thanks
Title:
Post by: plop on 12 December, 2003, 02:25:05
QuoteOriginally posted by c h i l l a
kepp you can search the LUA reference manual..  and you can look at this script made by plop
zcrazy (http://217.120.180.188/Forum4/redirect.php?dlid=32&PHPSESSID=0bf5be5f540fad31690c72b579b9d826)

whitch should actually, be in the finished scripts section..
really a cool way of holding functions. and only usiing one string arrival..  I think I can use this :))
that has been the bot where i learned the most from.
it's a good idea of posting it in the finished section indeed.
should have a newer version also, added some more things.

plop