# $integer

Casts a variable to an integer

Usage

    $integer(<data>)

Description

Forces <data> to be an integer data type with the following semantics:

- If <data> is an integer, <data> itself is returned.
- If <data> is a boolean, its numeric value is returned (either 1 or 0).
- If <data> is a real, its integer part is returned.
- If <data> is an array, the count of its items is returned.
- If <data> is a hash, the count of its items is returned.
- If <data> is a string, its length is returned.
- If <data> is an object, 0 is returned if the reference is null (invalid) and 1 otherwise

This function is similar to the C (int) cast and is internally aliased to $int() too. Note that since KVIrc does most of the casting work automatically you shouldn't need to use this function.

Syntax Specification

    <integer> $integer(<data:variant>)

See also
$real $boolean

Index, Functions

KVIrc 3.4.2 Documentation
Generated by root at Wed Jun 30 19:39:58 2010