MCPcopy Create free account
hub / github.com/Tencent/xLua / luaopen_i64lib

Function luaopen_i64lib

WebGLPlugins/i64lib.c:451–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449}
450
451LUALIB_API int luaopen_i64lib(lua_State* L)
452{
453#if LUA_VERSION_NUM == 501
454 lua_newtable(L);
455
456 lua_pushcfunction(L, int64_add);
457 lua_setfield(L, -2, "__add");
458
459 lua_pushcfunction(L, int64_sub);
460 lua_setfield(L, -2, "__sub");
461
462 lua_pushcfunction(L, int64_mul);
463 lua_setfield(L, -2, "__mul");
464
465 lua_pushcfunction(L, int64_div);
466 lua_setfield(L, -2, "__div");
467
468 lua_pushcfunction(L, int64_mod);
469 lua_setfield(L, -2, "__mod");
470
471 lua_pushcfunction(L, int64_unm);
472 lua_setfield(L, -2, "__unm");
473
474 lua_pushcfunction(L, int64_pow);
475 lua_setfield(L, -2, "__pow");
476
477 lua_pushcfunction(L, int64_tostring);
478 lua_setfield(L, -2, "__tostring");
479
480 lua_pushcfunction(L, int64_eq);
481 lua_setfield(L, -2, "__eq");
482
483 lua_pushcfunction(L, int64_lt);
484 lua_setfield(L, -2, "__lt");
485
486 lua_pushcfunction(L, int64_le);
487 lua_setfield(L, -2, "__le");
488
489 lua_rawseti(L, LUA_REGISTRYINDEX, INT64_META_REF);
490#endif
491 lua_newtable(L);
492
493 lua_pushcfunction(L, uint64_tostring);
494 lua_setfield(L, -2, "tostring");
495
496 lua_pushcfunction(L, uint64_compare);
497 lua_setfield(L, -2, "compare");
498
499 lua_pushcfunction(L, uint64_divide);
500 lua_setfield(L, -2, "divide");
501
502 lua_pushcfunction(L, uint64_remainder);
503 lua_setfield(L, -2, "remainder");
504
505 lua_pushcfunction(L, uint64_parse);
506 lua_setfield(L, -2, "parse");
507
508 lua_setglobal(L, "uint64");

Callers

nothing calls this directly

Calls 3

lua_setfieldFunction · 0.85
lua_rawsetiFunction · 0.85
lua_setglobalFunction · 0.70

Tested by

no test coverage detected