** Returns a pointer to the internal representation of an object. ** Note that ISO C does not allow the conversion of a pointer to ** function to a 'void*', so the conversion here goes through ** a 'size_t'. (As the returned pointer is only informative, this ** conversion should not be a problem.) */
| 490 | ** conversion should not be a problem.) |
| 491 | */ |
| 492 | LUA_API const void *lua_topointer (lua_State *L, int idx) { |
| 493 | const TValue *o = index2value(L, idx); |
| 494 | switch (ttypetag(o)) { |
| 495 | case LUA_VLCF: return cast_voidp(cast_sizet(fvalue(o))); |
| 496 | case LUA_VUSERDATA: case LUA_VLIGHTUSERDATA: |
| 497 | return touserdata(o); |
| 498 | default: { |
| 499 | if (iscollectable(o)) |
| 500 | return gcvalue(o); |
| 501 | else |
| 502 | return NULL; |
| 503 | } |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | |
| 508 |
no test coverage detected