MCPcopy Create free account
hub / github.com/defold/defold / InitializeHash

Function InitializeHash

engine/script/src/script_hash.cpp:425–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423 }
424
425 void InitializeHash(lua_State* L)
426 {
427 int top = lua_gettop(L);
428 luaL_newmetatable(L, SCRIPT_TYPE_NAME_HASH);
429
430 SCRIPT_HASH_TYPE_HASH = dmScript::SetUserType(L, -1, SCRIPT_TYPE_NAME_HASH);
431
432 luaL_openlib(L, 0x0, ScriptHash_methods, 0);
433
434 lua_pushliteral(L, "__eq");
435 lua_pushcfunction(L, Hash_eq);
436 lua_settable(L, -3);
437
438 lua_pushliteral(L, "__tostring");
439 lua_pushcfunction(L, Hash_tostring);
440 lua_settable(L, -3);
441
442 lua_pushliteral(L, "__concat");
443 lua_pushcfunction(L, Hash_concat);
444 lua_settable(L, -3);
445
446 lua_pushliteral(L, "__lt");
447 lua_pushcfunction(L, Hash_lt);
448 lua_settable(L, -3);
449
450 lua_pushliteral(L, "__gc");
451 lua_pushcfunction(L, Hash_gc);
452 lua_settable(L, -3);
453
454 lua_pushcfunction(L, Hash_new);
455 lua_setglobal(L, SCRIPT_TYPE_NAME_HASH);
456
457 lua_pushcfunction(L, HashToHex);
458 lua_setglobal(L, "hash_to_hex");
459
460 lua_pushcfunction(L, HashMD5);
461 lua_setglobal(L, "hashmd5");
462
463 lua_pop(L, 1);
464
465 assert(top == lua_gettop(L));
466 }
467
468 #undef SCRIPT_TYPE_NAME_HASH
469}

Callers 1

InitializeFunction · 0.85

Calls 5

lua_gettopFunction · 0.85
luaL_newmetatableFunction · 0.85
SetUserTypeFunction · 0.85
lua_settableFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected