fix hud libraries not removing after on_hud_close & fix segfault on illegal access to hud functions
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "api_lua.hpp"
|
||||
|
||||
#include "logic/scripting/scripting_hud.hpp"
|
||||
#include "graphics/render/WorldRenderer.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
|
||||
template <lua_CFunction func>
|
||||
inline int wrap_hud(lua_State* L) {
|
||||
if (scripting::hud == nullptr) {
|
||||
return luaL_error(
|
||||
L, "renderer is not initialized yet, see hud.lua on_hud_open event"
|
||||
);
|
||||
}
|
||||
return lua::wrap<func>(L);
|
||||
}
|
||||
Reference in New Issue
Block a user