Go to the documentation of this file.
81 #if LUA_VERSION_NUM >= 504
82 void*
ret = lua_newuserdatauv(
L,
size,
n);
84 void*
ret = lua_newuserdata(
L,
size);
85 lua_createtable(
L, 0,
n);
86 lua_setuservalue(
L, -2);
90 luaL_getmetatable(
L,
type);
91 assert(!lua_isnil(
L, -1));
92 lua_setmetatable(
L, -2);
97 #if LUA_VERSION_NUM < 504
99 lua_getuservalue(
L,
index);
101 lua_rawseti(
L, -2,
n);
107 lua_getuservalue(
L,
index);
108 lua_rawgeti(
L, -1,
n);
119 lua_rawget(
L, lua_upvalueindex(1));
120 if (!lua_isnil(
L, -1)) {
125 lua_pushvalue(
L, lua_upvalueindex(2));
133 const luaL_Reg* mm) {
134 luaL_newmetatable(
L,
name);
137 lupb_setfuncs(
L, mm);
141 lua_createtable(
L, 0, 0);
146 lua_getfield(
L, -2,
"__index");
147 if (lua_isnil(
L, -1)) {
152 lua_setfield(
L, -2,
"__index");
164 if (!lua_isboolean(
L, narg)) {
165 luaL_error(
L,
"must be true or false");
167 return lua_toboolean(
L, narg);
173 if (lua_type(
L, narg) != LUA_TSTRING) {
174 luaL_error(
L,
"Expected string");
177 return lua_tolstring(
L, narg,
len);
183 #define INTCHECK(type, ctype, min, max) \
184 ctype lupb_check##type(lua_State* L, int narg) { \
186 if (lua_isinteger(L, narg)) { \
187 return lua_tointeger(L, narg); \
191 luaL_checktype(L, narg, LUA_TNUMBER); \
192 n = lua_tonumber(L, narg); \
203 double max_value = (((double)max / 2) * 2) + 1; \
204 if ((modf(n, &i) != 0.0) || n < min || n >= max_value) { \
205 luaL_error(L, "number %f was not an integer or out of range for " #type, \
210 void lupb_push##type(lua_State* L, ctype val) { \
214 lua_pushnumber(L, val); \
230 luaL_checktype(
L, narg, LUA_TNUMBER);
231 return lua_tonumber(
L, narg);
238 luaL_checktype(
L, narg, LUA_TNUMBER);
239 return lua_tonumber(
L, narg);
249 #if LUA_VERSION_NUM == 501
250 const struct luaL_Reg funcs[] = {{NULL, NULL}};
251 luaL_register(
L,
"upb_c", funcs);
253 lua_createtable(
L, 0, 8);
void * lupb_newuserdata(lua_State *L, size_t size, int n, const char *type)
void lupb_def_registertypes(lua_State *L)
void lupb_pushfloat(lua_State *L, float d)
int lupb_indexmm(lua_State *L)
const char * upb_Status_ErrorMessage(const upb_Status *status)
const char * lupb_checkstring(lua_State *L, int narg, size_t *len)
int lua_setiuservalue(lua_State *L, int index, int n)
double lupb_checkdouble(lua_State *L, int narg)
int lua_getiuservalue(lua_State *L, int index, int n)
void lupb_checkstatus(lua_State *L, upb_Status *s)
void lupb_register_type(lua_State *L, const char *name, const luaL_Reg *m, const luaL_Reg *mm)
static bool lua_isinteger(lua_State *L, int argn)
unsigned __int64 uint64_t
float lupb_checkfloat(lua_State *L, int narg)
bool lupb_checkbool(lua_State *L, int narg)
int luaopen_lupb(lua_State *L)
void lupb_pushdouble(lua_State *L, double d)
bool upb_Status_IsOk(const upb_Status *status)
UniquePtr< SSL_SESSION > ret
#define INTCHECK(type, ctype, min, max)
void lupb_msg_registertypes(lua_State *L)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:47