MCPcopy Create free account
hub / github.com/DavidColson/Polybox / GetImpl

Function GetImpl

source/userdata.cpp:52–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50// ***********************************************************************
51
52i32 GetImpl(lua_State* L, UserData* pUserData, i32 index, i32 count) {
53 switch(pUserData->type) {
54 case Type::Float32: {
55 f32* pData = (f32*)pUserData->pData;
56 pData += index;
57 for (i32 i = 0; i < count; i++) {
58 lua_pushnumber(L, pData[i]);
59 }
60 break;
61 }
62 case Type::Int32: {
63 i32* pData = (i32*)pUserData->pData;
64 pData += index;
65 for (i32 i = 0; i < count; i++) {
66 lua_pushinteger(L, pData[i]);
67 }
68 break;
69 }
70 case Type::Int16: {
71 i16* pData = (i16*)pUserData->pData;
72 pData += index;
73 for (i32 i = 0; i < count; i++) {
74 lua_pushinteger(L, pData[i]);
75 }
76 break;
77 }
78 case Type::Uint8: {
79 u8* pData = (u8*)pUserData->pData;
80 pData += index;
81 for (i32 i = 0; i < count; i++) {
82 lua_pushunsigned(L, pData[i]);
83 }
84 break;
85 }
86 }
87
88 return count;
89}
90
91// ***********************************************************************
92

Callers 3

GetFunction · 0.85
Get2DFunction · 0.85
IndexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected