[Include] pointers.inc - Pointers for PAWN!
#43

There is one way to do it.. But it's a bit ugly.

pawn Код:
stock MyFunc(
    {Float, _, unused}:var1 = unused:0,
    {Float, _, unused}:var2 = unused:0,
    {Float, _, unused}:var3 = unused:0,
    {Float, _, unused}:var4 = unused:0,
    tag1 = tagof(var1),
    tag1 = tagof(var2),
    tag1 = tagof(var3),
    tag1 = tagof(var4)
) {
    if (tagof(var1) == tagof(unused:)) {
        num_vars = 0;
    } else if (tagof(var2) == tagof(unused:)) {
        num_vars = 1;
    } else if (tagof(var3) == tagof(unused:)) {
        num_vars = 2;
    } else if (tagof(var4) == tagof(unused:)) {
        num_vars = 3;
    } else {
        num_vars = 4;
    }

    var values[4], tags[4];
    values[0] = _:var1;
    values[1] = _:var2;
    values[2] = _:var3;
    values[3] = _:var4;
    tags[0] = tag1;
    tags[1] = tag2;
    tags[2] = tag3;
    tags[3] = tag4;

    // you now have values and tags in an array
    // if you want to allow many arguments, you must manually add more
}
Reply


Messages In This Thread
pointers.inc - Pointers for PAWN! - by Slice - 18.01.2012, 08:26
Re: pointers.inc - Pointers for PAWN! - by Ronaldo_raul™ - 18.01.2012, 08:33
Re: pointers.inc - Pointers for PAWN! - by SoUrAv - 18.01.2012, 08:39
Respuesta: pointers.inc - Pointers for PAWN! - by [Nikk] - 18.01.2012, 08:43
Re: pointers.inc - Pointers for PAWN! - by Lorenc_ - 18.01.2012, 08:50
Re: pointers.inc - Pointers for PAWN! - by T0pAz - 18.01.2012, 09:16
Re: pointers.inc - Pointers for PAWN! - by CaHbKo - 18.01.2012, 09:48
Re: pointers.inc - Pointers for PAWN! - by [S]trong - 18.01.2012, 10:20
Re: pointers.inc - Pointers for PAWN! - by steki. - 18.01.2012, 10:23
Re: pointers.inc - Pointers for PAWN! - by Niko_boy - 18.01.2012, 11:07
Re: pointers.inc - Pointers for PAWN! - by System64 - 18.01.2012, 11:14
Re: pointers.inc - Pointers for PAWN! - by CaHbKo - 18.01.2012, 11:30
Re: pointers.inc - Pointers for PAWN! - by Slice - 18.01.2012, 12:10
Re: pointers.inc - Pointers for PAWN! - by Ricop522 - 18.01.2012, 13:47
Re: pointers.inc - Pointers for PAWN! - by steki. - 18.01.2012, 15:26
Re: pointers.inc - Pointers for PAWN! - by Brian_G - 18.01.2012, 16:11
Re: pointers.inc - Pointers for PAWN! - by KingHual - 18.01.2012, 16:39
Re: pointers.inc - Pointers for PAWN! - by RyDeR` - 18.01.2012, 16:42
Re: pointers.inc - Pointers for PAWN! - by Zh3r0 - 18.01.2012, 17:11
Re: pointers.inc - Pointers for PAWN! - by steki. - 18.01.2012, 17:13
Re: pointers.inc - Pointers for PAWN! - by Zh3r0 - 18.01.2012, 17:17
Re: pointers.inc - Pointers for PAWN! - by steki. - 18.01.2012, 17:21
Re: pointers.inc - Pointers for PAWN! - by CaHbKo - 18.01.2012, 17:43
Re: pointers.inc - Pointers for PAWN! - by Slice - 18.01.2012, 17:50
Respuesta: pointers.inc - Pointers for PAWN! - by Adoniiz - 19.01.2012, 02:37
Re: pointers.inc - Pointers for PAWN! - by Slice - 19.01.2012, 04:58
Re: pointers.inc - Pointers for PAWN! - by The King's Bastard - 01.02.2012, 20:51
Re: pointers.inc - Pointers for PAWN! - by Slice - 02.02.2012, 06:42
Re: pointers.inc - Pointers for PAWN! - by The King's Bastard - 02.02.2012, 07:45
Re: pointers.inc - Pointers for PAWN! - by (LifeStealeR) - 02.02.2012, 08:32
Re: pointers.inc - Pointers for PAWN! - by Slice - 13.06.2012, 13:57
Re: pointers.inc - Pointers for PAWN! - by Hiddos - 13.06.2012, 14:38
Re: pointers.inc - Pointers for PAWN! - by Slice - 25.06.2012, 07:06
Re: pointers.inc - Pointers for PAWN! - by Яlackon - 28.07.2012, 22:04
Re: pointers.inc - Pointers for PAWN! - by BMB1 - 28.07.2012, 22:07
Re: pointers.inc - Pointers for PAWN! - by Ballu Miaa - 11.11.2012, 22:40
Re: pointers.inc - Pointers for PAWN! - by Dayvison_ - 27.03.2016, 23:31
Re: pointers.inc - Pointers for PAWN! - by Slice - 27.03.2016, 23:38
Re: pointers.inc - Pointers for PAWN! - by Dayvison_ - 28.03.2016, 00:01
Re: pointers.inc - Pointers for PAWN! - by Kar - 28.03.2016, 00:30
Re: pointers.inc - Pointers for PAWN! - by Slice - 28.03.2016, 08:20
Re: pointers.inc - Pointers for PAWN! - by Dayvison_ - 28.03.2016, 14:26
Re: pointers.inc - Pointers for PAWN! - by Slice - 28.03.2016, 16:18
Re: pointers.inc - Pointers for PAWN! - by Spmn - 25.05.2016, 20:56
Re: pointers.inc - Pointers for PAWN! - by Yashas - 26.05.2016, 04:29
Re: pointers.inc - Pointers for PAWN! - by Ivan_Ino - 26.05.2016, 11:24
Re: pointers.inc - Pointers for PAWN! - by vannesenn - 26.05.2016, 15:43
Re: pointers.inc - Pointers for PAWN! - by Yashas - 01.03.2017, 10:22
Re: pointers.inc - Pointers for PAWN! - by Nero_3D - 02.03.2017, 23:15
Re: pointers.inc - Pointers for PAWN! - by nG Inverse - 31.07.2017, 00:24
Re: pointers.inc - Pointers for PAWN! - by Damian - 08.03.2019, 14:46

Forum Jump:


Users browsing this thread: 6 Guest(s)