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

Function lua_len

3rd_party/lua_sol2/include/sol.hpp:2500–2517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2498}
2499
2500COMPAT53_API void lua_len(lua_State *L, int i) {
2501 switch (lua_type(L, i)) {
2502 case LUA_TSTRING:
2503 lua_pushnumber(L, (lua_Number)lua_objlen(L, i));
2504 break;
2505 case LUA_TTABLE:
2506 if (!luaL_callmeta(L, i, "__len"))
2507 lua_pushnumber(L, (lua_Number)lua_objlen(L, i));
2508 break;
2509 case LUA_TUSERDATA:
2510 if (luaL_callmeta(L, i, "__len"))
2511 break;
2512 /* FALLTHROUGH */
2513 default:
2514 luaL_error(L, "attempt to get length of a %s value",
2515 lua_typename(L, lua_type(L, i)));
2516 }
2517}
2518
2519COMPAT53_API int lua_rawgetp(lua_State *L, int i, const void *p) {
2520 int abs_i = lua_absindex(L, i);

Callers 2

lua_Integer luaL_lenFunction · 0.85
sizeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected