MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / bind_skr_guid

Function bind_skr_guid

modules/engine/lua/src/build.skr_lua.cpp:282–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282void bind_skr_guid(lua_State* L)
283{
284 luaL_Reg metamethods[] = {
285 { "__tostring", +[](lua_State* L) -> int {
286 auto guid = (skr_guid_t*)luaL_checkudata(L, 1, "skr_guid_t");
287 lua_pushstring(L, skr::format(u8"{}", *guid).c_str());
288 return 1;
289 } },
290 { "__eq", +[](lua_State* L) -> int {
291 auto guid1 = (skr_guid_t*)luaL_checkudata(L, 1, "skr_guid_t");
292 auto guid2 = (skr_guid_t*)luaL_checkudata(L, 2, "skr_guid_t");
293 lua_pushboolean(L, *guid1 == *guid2);
294 return 1;
295 } },
296 { nullptr, nullptr }
297 };
298 luaL_newmetatable(L, "skr_guid_t");
299 luaL_register(L, nullptr, metamethods);
300 lua_pop(L, 1);
301}
302
303void *luaL_testudata (lua_State *L, int i, const char *tname) {
304 void *p = lua_touserdata(L, i);

Callers 1

skr_lua_newstateFunction · 0.85

Calls 7

luaL_registerFunction · 0.85
luaL_checkudataFunction · 0.50
lua_pushstringFunction · 0.50
formatFunction · 0.50
lua_pushbooleanFunction · 0.50
luaL_newmetatableFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected