| 516 | } |
| 517 | |
| 518 | void 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 | |
| 541 | namespace skr::lua |
no test coverage detected