mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add advanced lua errors handler & fix hud script source path in traceback
This commit is contained in:
parent
2412699b89
commit
66be215101
5 changed files with 35 additions and 7 deletions
|
|
@ -76,13 +76,16 @@ void scripting::on_frontend_close() {
|
|||
}
|
||||
|
||||
void scripting::load_hud_script(
|
||||
const scriptenv& senv, const std::string& packid, const fs::path& file
|
||||
const scriptenv& senv,
|
||||
const std::string& packid,
|
||||
const fs::path& file,
|
||||
const std::string& fileName
|
||||
) {
|
||||
int env = *senv;
|
||||
std::string src = files::read_string(file);
|
||||
logger.info() << "loading script " << file.u8string();
|
||||
|
||||
lua::execute(lua::get_main_state(), env, src, file.u8string());
|
||||
lua::execute(lua::get_main_state(), env, src, fileName);
|
||||
|
||||
register_event(env, "init", packid + ":.init");
|
||||
register_event(env, "on_hud_open", packid + ":.hudopen");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue