MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / lua_topointer

Function lua_topointer

lib/lua/src/lapi.c:475–488  ·  view source on GitHub ↗

** 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.) */

Source from the content-addressed store, hash-verified

473** conversion should not be a problem.)
474*/
475LUA_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

Callers 2

str_formatFunction · 0.85
luaL_tolstringFunction · 0.85

Calls 2

index2valueFunction · 0.85
touserdataFunction · 0.85

Tested by

no test coverage detected