"Sputnik" help  
Sputnik Help
Language Reference - Classes - Class Magic Functions - LBound

Class Magic Functions - LBound

Overrides the LBound function its purpose is to return the lowest index in an array etc.

// define a class
class test
{
    Function __LBound($dim = 0)
    {
        if ($dim == 1)
            return -2;
        return -1;
    }
    Function __UBound($dim = 0)
    {
        if ($dim == 1)
            return 777;
        return 1337;
    }
}

// create new instance
my $a = new test();

// ask the class to return its lbound
say "LBound is: " . LBound($a);

// ask the class to return its lbound (dim 1)
say "LBound dim 1 is: " . LBound($a, 1);

// ask the class to return its ubound
say "UBound is: " . UBound($a);

// ask the class to return its ubound (dim 1)
say "UBound dim 1 is: " . UBound($a, 1);

// PRINTS
// LBound is: -1
// LBound dim 1 is: -2
// UBound is: 1337
// UBound dim 1 is: 777

This has similar usefulness that Count has in that its used internally inside Sputnik from time to time.

A full list of all possible magic functions can be found here.


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org