Dokumentation zu: to_int(E)

HR Image


SYNOPSIS
        int to_int(string)
        int to_int(float)
        int to_int(int)
        int to_int(closure)

        (int)<value>

DESCRIPTION
        Floats are truncated to integer values, strings with leadings
        digits are converted to integers up to the first non-digit.
        lfun-closures are converted into their function index (not adjusted
        for inheritance), variable closure are converted into their variable
        index.
        Integers are just returned.

        Regarding floats, it is important to keep rounding effects
        in mind: to_int(3.1*10.0) does not return 31, but instead 30,
        because internally the result of the multiplication is 30.999999.

        The function supports the '0x', '0o' and '0b' base prefixes.

BUGS
        The cast notation only works if the precise type of <value>
        is known at compile-time. This will not be fixed - use the
        function form instead.

HISTORY
        Introduced in 3.2.1@2.
        LDMud 3.2.11/3.3.611 added support for the base prefixes.

SEE ALSO
        to_string(E), sscanf(E)

Die Seite ist auch in Deutsch vorhanden.

Start » Magierhandbuch » Docu » Efun » To_int Letzte Generierung: 25.04.2021, 01:58
Email an: mud@wl.mud.de
Valid HTML 4.01!