MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / lua_len

Function lua_len

extlibs/sol3/include/sol/sol.hpp:2568–2585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2566}
2567
2568COMPAT53_API void lua_len(lua_State *L, int i) {
2569 switch (lua_type(L, i)) {
2570 case LUA_TSTRING:
2571 lua_pushnumber(L, (lua_Number)lua_objlen(L, i));
2572 break;
2573 case LUA_TTABLE:
2574 if (!luaL_callmeta(L, i, "__len"))
2575 lua_pushnumber(L, (lua_Number)lua_objlen(L, i));
2576 break;
2577 case LUA_TUSERDATA:
2578 if (luaL_callmeta(L, i, "__len"))
2579 break;
2580 /* FALLTHROUGH */
2581 default:
2582 luaL_error(L, "attempt to get length of a %s value",
2583 lua_typename(L, lua_type(L, i)));
2584 }
2585}
2586
2587COMPAT53_API int lua_rawgetp(lua_State *L, int i, const void *p) {
2588 int abs_i = lua_absindex(L, i);

Callers 2

lua_Integer luaL_lenFunction · 0.70
sizeMethod · 0.70

Calls 5

lua_typeFunction · 0.85
lua_pushnumberFunction · 0.85
luaL_callmetaFunction · 0.85
luaL_errorFunction · 0.85
lua_typenameFunction · 0.85

Tested by

no test coverage detected