1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
//! Contains definitions from `lua.h`.
use std::os::raw::c_int;
#[cfg(feature = "lua54")]
pub use super::lua54::lua::*;
#[cfg(feature = "lua53")]
pub use super::lua53::lua::*;
#[cfg(feature = "lua52")]
pub use super::lua52::lua::*;
#[cfg(any(feature = "lua51", feature = "luajit"))]
pub use super::lua51::lua::*;
#[cfg(feature = "luau")]
pub use super::luau::lua::*;
#[cfg(feature = "lua52")]
pub use super::compat53::{
lua_dump, lua_getextraspace, lua_getfield, lua_getglobal, lua_geti, lua_gettable,
lua_getuservalue, lua_isinteger, lua_pushlstring, lua_rawget, lua_rawgeti, lua_rawgetp,
lua_rawseti, lua_rotate, lua_seti, lua_stringtonumber, lua_tointeger, lua_tointegerx,
LUA_EXTRASPACE,
};
#[cfg(any(feature = "lua51", feature = "luajit"))]
pub use super::compat53::{
lua_absindex, lua_arith, lua_compare, lua_copy, lua_dump, lua_getextraspace, lua_getfield,
lua_getglobal, lua_geti, lua_gettable, lua_getuservalue, lua_isinteger, lua_len,
lua_pushglobaltable, lua_pushlstring, lua_pushstring, lua_rawget, lua_rawgeti, lua_rawgetp,
lua_rawlen, lua_rawseti, lua_rawsetp, lua_rotate, lua_seti, lua_setuservalue,
lua_stringtonumber, lua_tointeger, lua_tointegerx, lua_tonumberx,
};
#[cfg(feature = "luau")]
pub use super::compat53::{
lua_arith, lua_compare, lua_copy, lua_getextraspace, lua_getfield, lua_getglobal, lua_geti,
lua_gettable, lua_getuservalue, lua_isinteger, lua_len, lua_pushglobaltable, lua_pushlstring,
lua_pushstring, lua_rawget, lua_rawgeti, lua_rawgetp, lua_rawlen, lua_rawseti, lua_rawsetp,
lua_rotate, lua_seti, lua_setuservalue, lua_stringtonumber, lua_tointeger, lua_tointegerx,
};
#[cfg(any(feature = "lua52", feature = "lua53", feature = "lua54",))]
pub const LUA_MAX_UPVALUES: c_int = 255;
#[cfg(any(feature = "lua51", all(feature = "luajit", not(feature = "vendored"))))]
pub const LUA_MAX_UPVALUES: c_int = 60;
#[cfg(all(feature = "luajit", feature = "vendored"))]
pub const LUA_MAX_UPVALUES: c_int = 120;
#[cfg(feature = "luau")]
pub const LUA_MAX_UPVALUES: c_int = 200;
//
// Lua 5.4 compatibility layer
//
#[cfg(any(
feature = "lua53",
feature = "lua52",
feature = "lua51",
feature = "luajit",
feature = "luau"
))]
#[inline(always)]
pub unsafe fn lua_resume(
L: *mut lua_State,
from: *mut lua_State,
narg: c_int,
nres: *mut c_int,
) -> c_int {
#[cfg(any(feature = "lua51", feature = "luajit"))]
let _ = from;
#[cfg(any(feature = "lua51", feature = "luajit"))]
let ret = lua_resume_(L, narg);
#[cfg(any(feature = "lua53", feature = "lua52", feature = "luau"))]
let ret = lua_resume_(L, from, narg);
if (ret == LUA_OK || ret == LUA_YIELD) && !(nres.is_null()) {
*nres = lua_gettop(L);
}
ret
}
#[cfg(any(
feature = "lua54",
feature = "luau",
all(feature = "luajit", feature = "vendored")
))]
pub unsafe fn lua_resetthreadx(L: *mut lua_State, th: *mut lua_State) -> c_int {
#[cfg(all(feature = "luajit", feature = "vendored"))]
{
lua_resetthread(L, th);
LUA_OK
}
#[cfg(feature = "luau")]
{
let _ = L;
lua_resetthread(th);
LUA_OK
}
#[cfg(feature = "lua54")]
{
let _ = L;
lua_resetthread(th)
}
}
|