Lua 5.x bindings for the Rust programming language.
The current supported releases of Lua are 5.1, 5.2 and 5.3. Lua 5.0 support upcoming.
Add this to your Cargo.toml
:
toml
[dependencies]
lua-sys = "^0.2.0"
va-list
in their arguments,
a dependency on the va_list crate.embedded-lua
Features std
, embedded-lua
and va-list
are enabled by default.
When feature system-lua
is enabled, lua-sys will search for the Lua library using pkg-config on Unix and vcpkg on Windows.
Properties of the Lua library can be changed by defining the following environment variables:
LUACONFPREFIX
- LUA_32BITS
Enables Lua with 32-bit integers and 32-bit floats.
- LUA_C89_NUMBERS
Ensures that Lua uses the largest types available for C89.
- LUA_USE_C89
Controls the use of non-ISO-C89 features.
- LUA_NOCVTN2S
Define to turn off automatic coercion from numbers to strings.
- LUA_NOCVTS2N
Define LUA_NOCVTS2N to turn off automatic coercion from strings to numbers.
- LUA_INT_TYPE="LUA_INT_INT" | "LUA_INT_LONG" | "LUA_INT_LONGLONG"
Defines the type for Lua integers.
- LUA_FLOAT_TYPE="LUA_FLOAT_FLOAT" | "LUA_FLOAT_DOUBLE" | "LUA_FLOAT_LONGDOUBLE"
Defines the type for Lua floats.
- LUA_VERSION="<major>.<minor>.<patch>"
Sets the system Lua version, defaults to "5.3.5"
.
Example:
sh
$ export LUA_32BITS=1
$ export LUA_INT_TYPE="LUA_INT_INT"
$ export LUA_VERSION="5.2.0"
$ cargo build --no-default-features --features "system-lua va-list"
The LUA_CONF_PREFIX
variable can be used to change the name of the above variable:
sh
$ LUA_CONF_PREFIX="MY_CONF_" MY_CONF_LUA_USE_C89=1 cargo build
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.