summaryrefslogtreecommitdiff
path: root/src/ffi/lua51/lualib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ffi/lua51/lualib.rs')
-rw-r--r--src/ffi/lua51/lualib.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ffi/lua51/lualib.rs b/src/ffi/lua51/lualib.rs
new file mode 100644
index 0000000..2165221
--- /dev/null
+++ b/src/ffi/lua51/lualib.rs
@@ -0,0 +1,42 @@
+//! Contains definitions from `lualib.h`.
+
+use std::os::raw::c_int;
+
+use super::lua::lua_State;
+
+pub const LUA_COLIBNAME: &str = "coroutine";
+pub const LUA_TABLIBNAME: &str = "table";
+pub const LUA_IOLIBNAME: &str = "io";
+pub const LUA_OSLIBNAME: &str = "os";
+pub const LUA_STRLIBNAME: &str = "string";
+pub const LUA_MATHLIBNAME: &str = "math";
+pub const LUA_DBLIBNAME: &str = "debug";
+pub const LUA_LOADLIBNAME: &str = "package";
+
+#[cfg(feature = "luajit")]
+pub const LUA_BITLIBNAME: &str = "bit";
+#[cfg(feature = "luajit")]
+pub const LUA_JITLIBNAME: &str = "jit";
+#[cfg(feature = "luajit")]
+pub const LUA_FFILIBNAME: &str = "ffi";
+
+extern "C" {
+ pub fn luaopen_base(L: *mut lua_State) -> c_int;
+ pub fn luaopen_table(L: *mut lua_State) -> c_int;
+ pub fn luaopen_io(L: *mut lua_State) -> c_int;
+ pub fn luaopen_os(L: *mut lua_State) -> c_int;
+ pub fn luaopen_string(L: *mut lua_State) -> c_int;
+ pub fn luaopen_math(L: *mut lua_State) -> c_int;
+ pub fn luaopen_debug(L: *mut lua_State) -> c_int;
+ pub fn luaopen_package(L: *mut lua_State) -> c_int;
+
+ #[cfg(feature = "luajit")]
+ pub fn luaopen_bit(L: *mut lua_State) -> c_int;
+ #[cfg(feature = "luajit")]
+ pub fn luaopen_jit(L: *mut lua_State) -> c_int;
+ #[cfg(feature = "luajit")]
+ pub fn luaopen_ffi(L: *mut lua_State) -> c_int;
+
+ // open all builtin libraries
+ pub fn luaL_openlibs(L: *mut lua_State);
+}