MCPcopy Create free account
hub / github.com/SOUI2/soui / init_u64

Method init_u64

components/ScriptModule-LUA/lua_tinker/lua_tinker.cpp:117–144  ·  view source on GitHub ↗

---------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

115
116/*---------------------------------------------------------------------------*/
117void lua_tinker::init_u64(lua_State *L)
118{
119 const char* name = "__u64";
120 lua_newtable(L);
121
122 lua_pushstring(L, "__name");
123 lua_pushstring(L, name);
124 lua_rawset(L, -3);
125
126 lua_pushstring(L, "__tostring");
127 lua_pushcclosure(L, tostring_u64, 0);
128 lua_rawset(L, -3);
129
130 // 比较只会两边元表都是相同的元素才会进入比较
131 lua_pushstring(L, "__eq");
132 lua_pushcclosure(L, eq_u64, 0);
133 lua_rawset(L, -3);
134
135 lua_pushstring(L, "__lt");
136 lua_pushcclosure(L, lt_u64, 0);
137 lua_rawset(L, -3);
138
139 lua_pushstring(L, "__le");
140 lua_pushcclosure(L, le_u64, 0);
141 lua_rawset(L, -3);
142
143 lua_setglobal(L, name);
144}
145
146/*---------------------------------------------------------------------------*/
147/* excution */

Callers

nothing calls this directly

Calls 4

lua_pushstringFunction · 0.85
lua_rawsetFunction · 0.85
lua_pushcclosureFunction · 0.85
lua_setglobalFunction · 0.85

Tested by

no test coverage detected