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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#[inline]
pub unsafe fn lua_call(L: *mut lua_State, n: ::std::os::raw::c_int, r: ::std::os::raw::c_int) {
lua_callk(L, n, r, 0, None)
}
#[inline]
pub unsafe fn lua_pcall(
L: *mut lua_State,
n: ::std::os::raw::c_int,
r: ::std::os::raw::c_int,
f: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int {
lua_pcallk(L, n, r, f, 0, None)
}
#[inline]
pub unsafe fn lua_yield(L: *mut lua_State, n: ::std::os::raw::c_int) -> ::std::os::raw::c_int {
lua_yieldk(L, n, 0, None)
}
#[inline]
pub unsafe fn lua_tonumber(L: *mut lua_State, i: ::std::os::raw::c_int) -> lua_Number {
lua_tonumberx(L, i, 0 as _)
}
#[inline]
pub unsafe fn lua_tointeger(L: *mut lua_State, i: ::std::os::raw::c_int) -> lua_Integer {
lua_tointegerx(L, i, 0 as _)
}
#[inline]
pub unsafe fn lua_pop(L: *mut lua_State, n: ::std::os::raw::c_int) {
lua_settop(L, -n - 1)
}
#[inline]
pub unsafe fn lua_newtable(L: *mut lua_State) {
lua_createtable(L, 0, 0)
}
#[inline]
pub unsafe fn lua_pushcfunction(L: *mut lua_State, f: lua_CFunction) {
lua_pushcclosure(L, f, 0)
}
#[inline]
pub unsafe fn lua_isfunction(L: *mut lua_State, n: ::std::os::raw::c_int) -> bool {
lua_type(L, n) == LUA_TFUNCTION as _
}
#[inline]
pub unsafe fn lua_istable(L: *mut lua_State, n: ::std::os::raw::c_int) -> bool {
lua_type(L, n) == LUA_TTABLE as _
}
#[inline]
pub unsafe fn lua_islightuserdata(L: *mut lua_State, n: ::std::os::raw::c_int) -> bool {
lua_type(L, n) == LUA_TLIGHTUSERDATA as _
}
#[inline]
pub unsafe fn lua_isnil(L: *mut lua_State, n: ::std::os::raw::c_int) -> bool {
lua_type(L, n) == LUA_TNIL as _
}
#[inline]
pub unsafe fn lua_isboolean(L: *mut lua_State, n: ::std::os::raw::c_int) -> bool {
lua_type(L, n) == LUA_TBOOLEAN as _
}
#[inline]
pub unsafe fn lua_isthread(L: *mut lua_State, n: ::std::os::raw::c_int) -> bool {
lua_type(L, n) == LUA_TTHREAD as _
}
#[inline]
pub unsafe fn lua_isnone(L: *mut lua_State, n: ::std::os::raw::c_int) -> bool {
lua_type(L, n) == LUA_TNONE
}
#[inline]
pub unsafe fn lua_isnoneornil(L: *mut lua_State, n: ::std::os::raw::c_int) -> bool {
lua_type(L, n) <= 0
}
#[inline]
pub unsafe fn lua_pushliteral(
L: *mut lua_State,
s: *const ::std::os::raw::c_char,
) -> *const ::std::os::raw::c_char {
lua_pushstring(L, s)
}
#[inline]
pub unsafe fn lua_tostring(
L: *mut lua_State,
i: ::std::os::raw::c_int,
) -> *const ::std::os::raw::c_char {
lua_tolstring(L, i, 0 as _)
}
#[inline]
pub unsafe fn lua_insert(L: *mut lua_State, idx: ::std::os::raw::c_int) {
lua_rotate(L, idx, 1)
}
#[inline]
pub unsafe fn lua_remove(L: *mut lua_State, idx: ::std::os::raw::c_int) {
lua_rotate(L, idx, -1);
lua_pop(L, 1);
}
#[inline]
pub unsafe fn lua_replace(L: *mut lua_State, idx: ::std::os::raw::c_int) {
lua_copy(L, -1, idx);
lua_pop(L, 1);
}