mlua_sys/lua51/
lualib.rs

1//! Contains definitions from `lualib.h`.
2
3use std::os::raw::{c_char, c_int};
4
5use super::lua::lua_State;
6
7pub const LUA_COLIBNAME: *const c_char = cstr!("coroutine");
8pub const LUA_TABLIBNAME: *const c_char = cstr!("table");
9pub const LUA_IOLIBNAME: *const c_char = cstr!("io");
10pub const LUA_OSLIBNAME: *const c_char = cstr!("os");
11pub const LUA_STRLIBNAME: *const c_char = cstr!("string");
12pub const LUA_MATHLIBNAME: *const c_char = cstr!("math");
13pub const LUA_DBLIBNAME: *const c_char = cstr!("debug");
14pub const LUA_LOADLIBNAME: *const c_char = cstr!("package");
15
16#[cfg(feature = "luajit")]
17pub const LUA_BITLIBNAME: *const c_char = cstr!("bit");
18#[cfg(feature = "luajit")]
19pub const LUA_JITLIBNAME: *const c_char = cstr!("jit");
20#[cfg(feature = "luajit")]
21pub const LUA_FFILIBNAME: *const c_char = cstr!("ffi");
22
23#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))]
24unsafe extern "C-unwind" {
25    pub fn luaopen_base(L: *mut lua_State) -> c_int;
26    pub fn luaopen_table(L: *mut lua_State) -> c_int;
27    pub fn luaopen_io(L: *mut lua_State) -> c_int;
28    pub fn luaopen_os(L: *mut lua_State) -> c_int;
29    pub fn luaopen_string(L: *mut lua_State) -> c_int;
30    pub fn luaopen_math(L: *mut lua_State) -> c_int;
31    pub fn luaopen_debug(L: *mut lua_State) -> c_int;
32    pub fn luaopen_package(L: *mut lua_State) -> c_int;
33
34    #[cfg(feature = "luajit")]
35    pub fn luaopen_bit(L: *mut lua_State) -> c_int;
36    #[cfg(feature = "luajit")]
37    pub fn luaopen_jit(L: *mut lua_State) -> c_int;
38    #[cfg(feature = "luajit")]
39    pub fn luaopen_ffi(L: *mut lua_State) -> c_int;
40
41    // open all builtin libraries
42    pub fn luaL_openlibs(L: *mut lua_State);
43}