| 435 | |
| 436 | |
| 437 | LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { |
| 438 | const TValue *o = index2value(L, idx); |
| 439 | switch (ttypetag(o)) { |
| 440 | case LUA_VSHRSTR: return cast(lua_Unsigned, tsvalue(o)->shrlen); |
| 441 | case LUA_VLNGSTR: return cast(lua_Unsigned, tsvalue(o)->u.lnglen); |
| 442 | case LUA_VUSERDATA: return cast(lua_Unsigned, uvalue(o)->len); |
| 443 | case LUA_VTABLE: { |
| 444 | lua_Unsigned res; |
| 445 | lua_lock(L); |
| 446 | res = luaH_getn(L, hvalue(o)); |
| 447 | lua_unlock(L); |
| 448 | return res; |
| 449 | } |
| 450 | default: return 0; |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | |
| 455 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { |
nothing calls this directly
no test coverage detected