MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / typeerror

Function typeerror

src/Chain/libraries/glua/lauxlib.cpp:198–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197
198static int typeerror(lua_State *L, int arg, const char *tname) {
199 const char *msg;
200 const char *typearg; /* name for the type of the actual argument */
201 if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING)
202 typearg = lua_tostring(L, -1); /* use the given type name */
203 else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA)
204 typearg = "light userdata"; /* special name for messages */
205 else
206 typearg = luaL_typename(L, arg); /* standard name */
207 msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg);
208 global_glua_chain_api->throw_exception(L, THINKYOUNG_API_SIMPLE_ERROR, msg);
209 return luaL_argerror(L, arg, msg);
210}
211
212
213static void tag_error(lua_State *L, int arg, int tag) {

Callers 2

tag_errorFunction · 0.85
luaL_checkudataFunction · 0.85

Calls 5

luaL_getmetafieldFunction · 0.85
lua_typeFunction · 0.85
lua_pushfstringFunction · 0.85
luaL_argerrorFunction · 0.85
throw_exceptionMethod · 0.45

Tested by

no test coverage detected