** 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.) */
| 467 | ** conversion should not be a problem.) |
| 468 | */ |
| 469 | LUA_API const void *lua_topointer (lua_State *L, int idx) { |
| 470 | const TValue *o = index2value(L, idx); |
| 471 | switch (ttypetag(o)) { |
| 472 | case LUA_VLCF: return cast_voidp(cast_sizet(fvalue(o))); |
| 473 | case LUA_VUSERDATA: case LUA_VLIGHTUSERDATA: |
| 474 | return touserdata(o); |
| 475 | default: { |
| 476 | if (iscollectable(o)) |
| 477 | return gcvalue(o); |
| 478 | else |
| 479 | return NULL; |
| 480 | } |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | |
| 485 |
no test coverage detected