What Numbers shall i use, is there a list or a document?
 

What Numbers shall i use, is there a list or a document?

Started by kepp, 07 December, 2003, 22:33:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kepp

if strsub(data, 1, 3) == "$SR" or strsub(data, 1, 7) == "$Search" then

Ok, The ones above seems to work...

But what number should $ConnectToMe for instance have?
Is there a list or a document that will show what number for what...?

This is a big issue for me, and no doubt for others aswell..

i have 3 scripts that does the same from diferent authors,
they have different numbers after "data,"

Thanks
Guarding    

plop

strsub(s, i [, j])

returns another string, wich is a substring of s, starting @ 1 and running untill j: i and j may be negative, If j is absent, then it is assumed to be equal to -1 (wich is the same as the strings length).
In particular, the call strsub(s,1,j) returns a prefix of s with the length j, and the call strsub(s, -i) returns a suffix of s with length i.

(source: refman-4.0.pdf taken from //www.lua.org)

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Snoris

QuoteOriginally posted by plop
strsub(s, i [, j])

returns another string, wich is a substring of s, starting @ 1 and running untill j: i and j may be negative, If j is absent, then it is assumed to be equal to -1 (wich is the same as the strings length).
In particular, the call strsub(s,1,j) returns a prefix of s with the length j, and the call strsub(s, -i) returns a suffix of s with length i.

(source: refman-4.0.pdf taken from //www.lua.org)

plop

Nice...Now I've even learned how to speak spanish :]

That is just letters for me...In a strange way =))

But...I probably will learn SOMETHING this lifetime ;)

plop

#3
The strsub(s,i,j) function extracts a piece of the string s, from the i-th to the j-th character inclusive. In Lua, the first character of a string has index 1.
You can use also negative indices, which count from the end of the string: The index −1 refers to the last character in a string, −2 to the previous one, and so on. Therefore, the call strsub(s, 1, j) gets a prefix of the string s with length j; strsub(s, j, -1) gets a suffix of the string, starting at the j-th character (if you do not provide a third argument, it defaults to −1, so the last call could be written as strsub(s, j)); and strsub(s, 2, -2) removes the first and last characters of a string: If s is "[in brackets]", strsub(s, 2, -2) will be "in brackets".

maby this is more clear, luabook1.pdf  also from the same site.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

Ah well :D
I guess i need to spend some hours reading this :) Thanks though
Guarding    

Snoris

*if Brain says ("Syntax error" or "blackout") then :]

Shit I must have this in swedish....If Im not tired Im getting blackout about this ;)

kepp

Sorry snoris, Det l?r ta hundra ?r och ?vers?tta det....

In english =

Sorry snoris, That will take about 100 years to translate!!
Guarding    

Snoris

QuoteOriginally posted by kepp
Sorry snoris, Det l?r ta hundra ?r och ?vers?tta det....

In english =

Sorry snoris, That will take about 100 years to translate!!
'
FFS lamer come ooooon :]

Give me a hand :D

kepp

The strsub(s,i,j) function extracts a piece of the string s, from the i-th to the j-th character inclusive. In Lua, the first character of a string has index 1.
You can use also negative indices, which count from the end of the string: The index −1 refers to the last character in a string, −2 to the previous one, and so on. Therefore, the call strsub(s, 1, j) gets a prefix of the string s with length j; strsub(s, j, -1) gets a suffix of the string, starting at the j-th character (if you do not provide a third argument, it defaults to −1, so the last call could be written as strsub(s, j)); and strsub(s, 2, -2) removes the first and last characters of a string: If s is "[in brackets]", strsub(s, 2, -2) will be "in brackets".


SWEDISH :

strsub funktionen extracts en del av tjejernas string s,
fr?n i:et till j:et. I LUA, har den f?rsta bokstaven i tjejernas string index 1 (ett).
du kan ?ven anv?nda negativa idikationer, vilket r?knas fr?n slutet av tjejernas string: Indikationen −1


Sen orkar jag inte mer :)
Guarding    

plop

start the next script with the command line lua.exe.
it gives a simple example of what strsub does.
text = "test string"
start = 1
End = 1

for i=1,strlen(text) do
   string2 = strsub(text, start, End)
   print(string2)
   End = End +1
end
for i=1,strlen(text) do
   string2 = strsub(text, start, End)
   print(string2)
   start = start + 1
end
this is the result.
t
te
tes
test
test
test s
test st
test str
test stri
test strin
test string
test string
est string
st string
t string
 string
string
tring
ring
ing
ng
g
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

#10
$ConnectToMe

so... $ConnectToMe will have 1,12 ?

If i try 1,11 in Lua.exe it won't give me the whole thing...


$  C  o  n   n  e   c   t   T   o  M  e
^ ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^
1  2  3   4   5  6   7  8   9  10  11  12


As there are 12 Characters...
that's how i get it
Guarding    

plop

QuoteOriginally posted by kepp
$ConnectToMe

so... $ConnectToMe will have 1,12 ?

If i try 1,11 in Lua.exe it won't give me the whole thing...


$  C  o  n   n  e   c   t   T   o  M  e
^ ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^
1  2  3   4   5  6   7  8   9  10  11  12


As there are 12 Characters...
that's how i get it
yep, if you wanne find a string wich is always in the same place this is the best way 2 find it.
strfind(data, "%$ConnectToMe") can even get the wrong result if you for example say $ConnectToMe in mainchat.
if data = <[TGA-OP]plop> $ConnectToMe then strfind(data, "%$ConnectToMe") whill give a match.
but strsub(data, 1,12) whill return <[TGA-OP]plo, wich is ~= 2 $ConnectToMe.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk