Lua-API++  2015-02-12-3
Lua-API++ library
Configuring the library

Additional library features can be configured with special macros. These macros must be defined project-wide to maintain consistency.

Compatibility

Lua language version

  • LUAPP_COMPATIBILITY_V51;
  • LUAPP_COMPATIBILITY_V52;
  • LUAPP_COMPATIBILITY_V53.

NRVO support

The macro LUAPP_COMPATIBILITY_NO_NRVO disables tests that require NRVO compiler capability. Also it disables the getUpvalues method that requires NRVO too.

Discardability

Operation that produces temporary Lua value may be skipped if the operation result is never used. Such operation is called "discardable". The non-discardable operations are executed no matter what happens to results.

By default, only function calls are non-discardable, but it is possible to switch this mode for:

  • indexing, with LUAPP_NONDISCARDABLE_INDEX;
  • arithmetic operations [Lua 5.2+ only], with LUAPP_NONDISCARDABLE_ARITHMETICS;
  • concatenation, with LUAPP_NONDISCARDABLE_CONCAT;
  • all of the above, with LUAPP_NONDISCARDABLE_ALL.

Performance

To achieve best performance, API-dependent part may be included in headers as a set of inline functions. This mode can be used when link-time code generation is not available and the performance is crucial.

It is turned on with LUAPP_HEADER_ONLY macro and impl.cpp no longer needs to be included. Note that in this mode all Lua API functions will be exposed to your source.

Debugging: stack integrity checking

The LUAPP_WATCH_STACK enables special mode of stack integrity checking at the exense of some operational overhead. In this mode, when the correct sequence of stack operations is broken, non-catchable exceptions will be raised, leading to immediate program termination.

This mode is recommended for debug purposes only.