| 482 | |
| 483 | |
| 484 | LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { |
| 485 | const TValue *o = index2value(L, idx); |
| 486 | switch (ttypetag(o)) { |
| 487 | case LUA_VSHRSTR: return cast(lua_Unsigned, tsvalue(o)->shrlen); |
| 488 | case LUA_VLNGSTR: return cast(lua_Unsigned, tsvalue(o)->u.lnglen); |
| 489 | case LUA_VUSERDATA: return cast(lua_Unsigned, uvalue(o)->len); |
| 490 | case LUA_VTABLE: { |
| 491 | lua_Unsigned res; |
| 492 | lua_lock(L); |
| 493 | res = luaH_getn(L, hvalue(o)); |
| 494 | lua_unlock(L); |
| 495 | return res; |
| 496 | } |
| 497 | default: return 0; |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | |
| 502 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { |
nothing calls this directly
no test coverage detected