Flags

LuaFAR 3

Flags


As Far API makes wide use of named integer constants, there is a necessity to represent those constants in Lua. LuaFAR keeps the names and values of the constants in tables. Most constants are embedded into LuaFAR, in the tables far.Flags and far.Colors.

This manual uses the term flags for both a single constant contained in the table far.Flags, and for the bitwise OR of two or more such constants.

When some function parameter in this manual is denoted as flags, it can be supplied from Lua as either an integer, a string (when a combination consists of one flag), or a table, with keys corresponding to constants' names and having non-false values.

Example 1 (single flag)

The following 2 calls are equivalent:

    (1)  editor.UndoRedo(nil, F.EUR_UNDO) -- where F=far.Flags
    (2)  editor.UndoRedo(nil, "EUR_UNDO")

Example 2 (flags combination)

The 7-th parameter to function editor.Editor can be supplied from Lua in the following equivalent forms:

    (1)  bit64.bor(F.EF_NONMODAL, F.EF_IMMEDIATERETURN, ....)
    (2)  { EF_NONMODAL=1, EF_IMMEDIATERETURN=1, .... }