** Returns a pointer to the internal representation of an object. ** Note that ANSI 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.) */
| 473 | ** conversion should not be a problem.) |
| 474 | */ |
| 475 | LUA_API const void *lua_topointer (lua_State *L, int idx) { |
| 476 | const TValue *o = index2value(L, idx); |
| 477 | switch (ttypetag(o)) { |
| 478 | case LUA_VLCF: return cast_voidp(cast_sizet(fvalue(o))); |
| 479 | case LUA_VUSERDATA: case LUA_VLIGHTUSERDATA: |
| 480 | return touserdata(o); |
| 481 | default: { |
| 482 | if (iscollectable(o)) |
| 483 | return gcvalue(o); |
| 484 | else |
| 485 | return NULL; |
| 486 | } |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | |
| 491 |
no test coverage detected