lesser the 'return 1' feature ;)
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

lesser the 'return 1' feature ;)

Started by Herodes, 24 September, 2006, 12:40:10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Herodes

Can we have the following API calls return 1 pls ?

SendToAll(FromNick, Data)
SendToAll(Data)
SendPmToAll(FromNick, Data)
SendToNick(Nick, Data)
SendPmToNick(ToNick, FromNick, Data)
SendToOps(FromNick, Data)
SendToOps(Data)
SendPmToOps(FromNick, Data)
userObj:SendData(FromNick, Data)
userObj:SendPM(FromNick, Data)

so that we get less of
user:SendData( "bot", "look you I don't send what you sent me!!" )
return 1

and more of
return user:SendData( "bot", "look you I don't send what you sent me!!" )


GeceBekcisi

What if we need to use

Code: lua
user:SendData( "bot", "look you I don't send what you sent me!!" )
SendPmToOps( "bot", user.sName.." has tried to check our new feature" )


?
Do you need an advanced user handling script? Download UserBekcisi today (Latest Edit)
Features: User + ISP + GeoIP database, user info + share checking and many more...

Herodes

Quote from: GeceBekcisi on 24 September, 2006, 18:45:08
What if we need to use

Code: lua
user:SendData( "bot", "look you I don't send what you sent me!!" )
SendPmToOps( "bot", user.sName.." has tried to check our new feature" )


?
no problem at all... check this...
Code: lua
function foo()
  return 1;
end

function bar()
  return "ok"
end

function foobar()
  foo()
  bar()
end

foobar() --> returns nothing,...

function foobar()
  foo()
  return bar()
end

foobar() --> returns "ok"

function foobar()
  return foo()
  bar()
end

foobar() --> returns 1 (bar() doesn't get a chance to be processed ;)


bastya_elvtars

Hmmm.... what is the problem? I have a bad flu, but I wouldn1t understand even if I were healthy.
Everything could have been anything else and it would have just as much meaning.

Herodes

Quote from: bastya_elvtars on 24 September, 2006, 22:26:26
Hmmm.... what is the problem? I have a bad flu, but I wouldn1t understand even if I were healthy.
notin,... but it will save ppl from coding like dogs, have you seen how much the following function is saving scripts ?
function SendBack( user, msg, how )
    if how then user:SendPM( sBot, msg ); return 1; end
    user:SendData( sBot, msg ); return 1;
end


if not I'll post smth here ;)

bastya_elvtars

function SendBack( user, msg, how )
    return {["pm"]=user.SendPM}[how](user,sBot,msg) or user.SendData(user,sBot,msg),1 
end
Everything could have been anything else and it would have just as much meaning.

Herodes

Quote from: bastya_elvtars on 24 September, 2006, 22:55:14
function SendBack( user, msg, how )
    return {["pm"]=user.SendPM}[how](user,sBot,msg) or user.SendData(user,sBot,msg),1 
end

now,... this is so c00l it can be the cause of your flu!

bastya_elvtars

Quote from: Herodes on 24 September, 2006, 23:01:00
now,... this is so c00l it can be the cause of your flu!
Some of my chunks are not for the weak of mind. :-P
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk