PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: dragos_sto on 16 May, 2007, 13:47:45

Title: MyINFOArrival(User, Data)
Post by: dragos_sto on 16 May, 2007, 13:47:45
Code (lua) Select

function MyINFOArrival(User, Data)
SendToAll("MyINFOArrival","\r\n\t\tMyINFOArrival\r\ndate returnare \r\n "..Data.."\r\n")
for key, value in pairs(User) do
SendToAll("MyINFOArrival","date returnare User \r\n User."..key.." = "..value.."")
end
end
[/color]


return
Code (actionscript) Select
[14:38] <MyINFOArrival>
MyINFOArrival
date returnare
$MyINFO $ALL Plich <++ V:0.674,M:A,H:4/0/2,S:4>$ $LAN(T3)$$24338686918$
[14:38]

[14:38] <MyINFOArrival> date returnare User
User.sDescription =
[14:38] <MyINFOArrival> date returnare User
User.iOpHubs = 2
[14:38] <OnError> date returnare
dragos work\ptokax 0.3.6.0\scripts\functii.lua:45: attempt to concatenate local 'value' (a function value)OnError
[/color]


what function it about ?
my ideea it whas to see the table of user
user. ... and the value of them
Title: Re: MyINFOArrival(User, Data)
Post by: bastya_elvtars on 16 May, 2007, 13:50:02
What if you made a check and if value is not a string/number then not concatenate it?
Title: Re: MyINFOArrival(User, Data)
Post by: dragos_sto on 16 May, 2007, 15:02:00
let say i was curios of all the function
aveilable on user. ...

function MyINFOArrival(User, Data)
   SendToAll("MyINFOArrival","\r\n\t\tMyINFOArrival\r\ndate returnare \r\n "..Data.."\r\n")
   for key, value in pairs(User) do
      if (key~="Redirect" and key~="Ban" and key~="Disconnect" and key~="uptr" and key~="TempBan" and key ~= "TimeBan" and key~="NickBan" and key~="NickTempBan" and key~="DefloodWarn" and key~="SendPM" and key~="Kick" and key~="SendData") then
      SendToAll("MyINFOArrival","date returnare User \t\t\t User."..key.." = "..value.."\r\n")
      end
   end
end

all the function when i whant to see the value return error like this attempt to concatenate local 'value' (a function value)
User.Redirect
User.Ban

User.Disconnect
User.uptr
User.TempBan
User.TimeBan
User.NickBan
User.NickTempBan
User.DefloodWarn
User.SendPM
User.Kick
User.SendData

if you whant to see the data return to un unreg user let my know  ;D
when i look at scripting-interface
i understand why return it a function ,becaus it is :)

next time i will look careful

User:
-----
SendData(FromNick, Data)      - Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
SendData(Data)            - Data without ending | ! Max Data length 128000 chars.
SendPM(FromNick, Data)         - Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
Disconnect()
Kick(KickerNick, Reason)      - Reason without ending | ! Max KickerNick length 64 chars, max Reason length 128000 chars.
Kick(Reason)            - Reason without ending | ! Max Reason length 128000 chars.
Ban()
Ban(sReason, sBy, bFull)
NickBan()
NickBan(sReason, sBy)
TempBan()
TempBan(iTime, sReason, sBy, bFull)   - iTime is in minutes (0 = default tempban time from gui) !
TimeBan(iTime)            - iTime is in minutes (0 = default tempban time from gui) !
NickTempBan(iTime, sReason, sBy)   - iTime is in minutes (0 = default tempban time from gui) !
Redirect(Address)         - Max Address length 1024 chars.
Redirect(Address, Reason)      - Max Address length 1024 chars. Max Reason length 128000 chars.

are some function hoo i dont find in scripting interface
like User.uptr for example
Title: Re: MyINFOArrival(User, Data)
Post by: bastya_elvtars on 16 May, 2007, 15:06:17
I suggest using the type() function.
Title: Re: MyINFOArrival(User, Data)
Post by: dragos_sto on 16 May, 2007, 16:08:13
i dont understand how ?
you kant show me an example pls.
Title: Re: MyINFOArrival(User, Data)
Post by: bastya_elvtars on 16 May, 2007, 16:17:19
I rather give you suggestions so you can find out yourself (and learn):
- First read this (http://www.lua.org/manual/5.1/manual.html#pdf-type).
- Then, you will find out how to select only number and string variables that can be concatenated into a string.
Title: Re: MyINFOArrival(User, Data)
Post by: dragos_sto on 16 May, 2007, 16:24:52
10x i whill read once again :)
Title: Re: MyINFOArrival(User, Data)
Post by: Thor on 16 May, 2007, 18:15:14
Or maybe use tostring(), and you can see all the userobject, and which hasn't got 'normal' values, that's functions (afaik memory adresses :) )
Title: Re: MyINFOArrival(User, Data)
Post by: dragos_sto on 16 May, 2007, 19:19:15
true after 2 month i work again whit lua :D
and some function i forget them :(