MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaB_assert

Function luaB_assert

3rd/lua-5.4.3/src/lbaselib.c:404–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402
403
404static int luaB_assert (lua_State *L) {
405 if (l_likely(lua_toboolean(L, 1))) /* condition is true? */
406 return lua_gettop(L); /* return all arguments */
407 else { /* error */
408 luaL_checkany(L, 1); /* there must be a condition */
409 lua_remove(L, 1); /* remove it */
410 lua_pushliteral(L, "assertion failed!"); /* default message */
411 lua_settop(L, 1); /* leave only message (default if no other one) */
412 return luaB_error(L); /* call 'error' */
413 }
414}
415
416
417static int luaB_select (lua_State *L) {

Callers

nothing calls this directly

Calls 5

lua_tobooleanFunction · 0.85
lua_gettopFunction · 0.85
luaL_checkanyFunction · 0.85
lua_settopFunction · 0.85
luaB_errorFunction · 0.85

Tested by

no test coverage detected