MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / lua_topointer

Function lua_topointer

3rd/lua-5.4.3/src/lapi.c:469–482  ·  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

467** conversion should not be a problem.)
468*/
469LUA_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

Callers 2

str_formatFunction · 0.85
luaL_tolstringFunction · 0.85

Calls 2

index2valueFunction · 0.85
touserdataFunction · 0.85

Tested by

no test coverage detected