Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 7169427

Browse files
committed
More definitions & Fix checklstring
1 parent d1f29c8 commit 7169427

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#[deprecated(
66
since = "0.2.0",
7-
note = "Use b\"string\".as_ptr() as std::os::raw::c_char format or CStrings directly instead."
7+
note = "Use b\"string\\0\".as_ptr() format or CStrings directly instead."
88
)]
99
#[macro_export]
1010
macro_rules! cstring {

src/lua_shared.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ pub const LUA_SHARED_RAW: Lazy<Library> = Lazy::new(|| {
6060
use std::path::PathBuf;
6161
use once_cell::sync::Lazy;
6262
use crate::types::*;
63-
use crate::globals::Lua::GLOBALSINDEX;
63+
use crate::globals::Lua::{self, GLOBALSINDEX};
6464

6565
// Load lua Code
6666
expose_symbol!( luaL_loadbufferx, CInt, (state: LuaState, code: CharBuf, size: SizeT, id: CharBuf, mode: CharBuf) );
6767
expose_symbol!( luaL_loadbuffer, CInt, (state: LuaState, code: CharBuf, size: SizeT, id: CharBuf) );
6868
expose_symbol!( luaL_loadstring, CInt, (state: LuaState, code: CharBuf) );
69+
expose_symbol!( luaL_loadfile, CInt, (state: LuaState, filename: CharBuf) );
70+
expose_symbol!( luaL_loadfilex, CInt, (state: LuaState, filename: CharBuf, mode: CharBuf) );
6971

7072
// Call lua code
7173
expose_symbol!( lua_pcall, CInt, (state: LuaState, nargs: CInt, nresults: CInt, msgh: CInt) );
@@ -119,7 +121,7 @@ expose_symbol!( lua_pushfstring, CharBuf, (state: LuaState, fmt: CharBuf, ...) )
119121
// Type Checks
120122
expose_symbol!( luaL_checkinteger, LuaInteger, (state: LuaState, narg: CInt) );
121123
expose_symbol!( luaL_checknumber, LuaNumber, (state: LuaState, narg: CInt) );
122-
expose_symbol!( luaL_checklstring, CharBuf, (state: LuaState, narg: CInt) );
124+
expose_symbol!( luaL_checklstring, CharBuf, (state: LuaState, narg: CInt, len: SizeT) );
123125

124126
// Type Checks that return nothing
125127
expose_symbol!( luaL_checkstack, (), (state: LuaState, size: CInt, msg: CharBuf) );
@@ -150,6 +152,26 @@ expose_symbol!( lua_rawequal, CInt, (state: LuaState, ind1: CInt, ind2: CInt) );
150152
// Raising Errors
151153
expose_symbol!( luaL_typerror, CInt, (state: LuaState, narg: CInt, typename: CharBuf) );
152154

155+
// Open
156+
expose_symbol!( luaopen_table, CInt, (state: LuaState) );
157+
expose_symbol!( luaopen_string, CInt, (state: LuaState) );
158+
expose_symbol!( luaopen_package, CInt, (state: LuaState) );
159+
expose_symbol!( luaopen_os, CInt, (state: LuaState) );
160+
expose_symbol!( luaopen_math, CInt, (state: LuaState) );
161+
expose_symbol!( luaopen_jit, CInt, (state: LuaState) );
162+
expose_symbol!( luaopen_debug, CInt, (state: LuaState) );
163+
expose_symbol!( luaopen_bit, CInt, (state: LuaState) );
164+
expose_symbol!( luaopen_base, CInt, (state: LuaState) );
165+
expose_symbol!( luaL_openlib, CInt, (state: LuaState) );
166+
167+
// Ref
168+
expose_symbol!( luaL_ref, CInt, (state: LuaState, t: CInt) );
169+
expose_symbol!( luaL_unref, (), (state: LuaState, t: CInt, r: CInt) );
170+
171+
// Metatables
172+
expose_symbol!( luaL_newmetatable, CInt, (state: LuaState, tname: CharBuf) );
173+
expose_symbol!( luaL_newmetatable_type, CInt, (state: LuaState, tname: CharBuf, typ: CInt) );
174+
153175
#[inline(always)]
154176
pub fn lua_pop(state: LuaState, ind: CInt) {
155177
lua_settop( state, -(ind)-1 );

0 commit comments

Comments
 (0)