** 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.) */
| 444 | ** conversion should not be a problem.) |
| 445 | */ |
| 446 | LUA_API const void *lua_topointer (lua_State *L, int idx) { |
| 447 | const TValue *o = index2value(L, idx); |
| 448 | switch (ttypetag(o)) { |
| 449 | case LUA_VLCF: return cast_voidp(cast_sizet(fvalue(o))); |
| 450 | case LUA_VUSERDATA: case LUA_VLIGHTUSERDATA: |
| 451 | return touserdata(o); |
| 452 | default: { |
| 453 | if (iscollectable(o)) |
| 454 | return gcvalue(o); |
| 455 | else |
| 456 | return NULL; |
| 457 | } |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | |
| 462 |
no test coverage detected