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

Function bind_skr_log

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

Source from the content-addressed store, hash-verified

516}
517
518void bind_skr_log(lua_State* L)
519{
520 //lua_atpanic(L, +[](lua_State* L) -> int {
521 // SKR_LOG_FATAL(u8"Lua panic: %s", lua_tostring(L, -1));
522 // return 0;
523 //});
524 lua_getglobal(L, "skr");
525 lua_pushcfunction(L, &skr_lua_log<SKR_LOG_LEVEL_INFO>, "print");
526 lua_setfield(L, -2, "print");
527 lua_pushcfunction(L, &skr_lua_log<SKR_LOG_LEVEL_DEBUG>, "log_debug");
528 lua_setfield(L, -2, "log_debug");
529 lua_pushcfunction(L, &skr_lua_log<SKR_LOG_LEVEL_INFO>, "log_info");
530 lua_setfield(L, -2, "log_info");
531 lua_pushcfunction(L, &skr_lua_log<SKR_LOG_LEVEL_WARN>, "log_warn");
532 lua_setfield(L, -2, "log_warn");
533 lua_pushcfunction(L, &skr_lua_log<SKR_LOG_LEVEL_ERROR>, "log_error");
534 lua_setfield(L, -2, "log_error");
535 lua_pushcfunction(L, &skr_lua_log<SKR_LOG_LEVEL_FATAL>, "log_fatal");
536 lua_setfield(L, -2, "log_fatal");
537 lua_pop(L, 1);
538}
539} // namespace skr::lua
540
541namespace skr::lua

Callers 1

skr_lua_newstateFunction · 0.85

Calls 2

lua_getglobalFunction · 0.85
lua_setfieldFunction · 0.50

Tested by

no test coverage detected