static void * luaV_checkudata(lua_State *L, int ud, const char *tname) { void *p = luaV_toudata(L, ud, tname); if (p == NULL) luaL_typeerror(L, ud, tname); return p; }
static int getcflags (lua_State *L, int pos) { switch (lua_type (L, pos)) { case LUA_TNONE: case LUA_TNIL: return ALG_CFLAGS_DFLT; case LUA_TNUMBER: return lua_tointeger (L, pos); case LUA_TSTRING: { const char *s = lua_tostring (L, pos); int res = 0, ch; while ((ch = *s++) != '\0') { if (ch == 'i') res |= ONIG_OPTION_IGNORECASE; else if (ch == 'm') res |= ONIG_OPTION_NEGATE_SINGLELINE; else if (ch == 's') res |= ONIG_OPTION_MULTILINE; else if (ch == 'x') res |= ONIG_OPTION_EXTEND; /* else if (ch == 'U') res |= PCRE_UNGREEDY; */ /* else if (ch == 'X') res |= PCRE_EXTRA; */ } return res; } default: return luaL_typeerror (L, pos, "number or string"); } }
static void tag_error (lua_State *L, int arg, int tag) { luaL_typeerror(L, arg, lua_typename(L, tag)); }
/*-------------------------------------------------------------------------*\ * Make sure argument is a boolean \*-------------------------------------------------------------------------*/ int auxiliar_checkboolean(lua_State *L, int objidx) { if (!lua_isboolean(L, objidx)) luaL_typeerror(L, objidx, lua_typename(L, LUA_TBOOLEAN)); return lua_toboolean(L, objidx); }