The Teal Standard Library and Lua compatibility
tl supports a fair subset of the Lua 5.3 standard library (even in other Lua versions, using compat-5.3), avoiding 5.3-isms that are difficult to reproduce in other Lua implementations.
It declares all entries of the standard library as <const>
, and assumes that
Lua libraries don't modify it. If your Lua environment modifies the standard
library with incompatible behaviors, tl will be oblivious to it and you're on
your own.
The Teal compiler also supports Lua-5.3-style bitwise operators (&
, |
, ~
,
<<
, >>
) and the integer division //
operator on all supported Lua
versions. For Lua versions that do not support it natively, it generates code
using the bit32 library, which is also included in compat-5.3 for Lua 5.1.
You can explicitly disable the use of compat-5.3 with the --skip-compat53
flag and equivalent option in tlconfig.lua
. However, if you do so, the Lua
code generated by your Teal program may not behave consistently across different
target Lua versions, and differences in behavior across Lua standard libraries
will reflect in Teal. In particular, the operator support described above may
not work.