process page test
This commit is contained in:
@@ -240,6 +240,15 @@ void scripting::on_ui_open(
|
||||
});
|
||||
}
|
||||
|
||||
void scripting::on_ui_progress(UiDocument* layout, int workDone, int workTotal) {
|
||||
std::string name = layout->getId() + ".progress";
|
||||
emit_event(name, [=] (lua::LuaState* state) {
|
||||
state->pushinteger(workDone);
|
||||
state->pushinteger(workTotal);
|
||||
return 2;
|
||||
});
|
||||
}
|
||||
|
||||
void scripting::on_ui_close(UiDocument* layout, Inventory* inventory) {
|
||||
std::string name = layout->getId() + ".close";
|
||||
emit_event(name, [inventory] (lua::LuaState* state) {
|
||||
@@ -330,6 +339,7 @@ void scripting::load_layout_script(scriptenv senv, std::string prefix, fs::path
|
||||
state->loadbuffer(env, src, file.u8string());
|
||||
state->callNoThrow(0);
|
||||
script.onopen = register_event(env, "on_open", prefix+".open");
|
||||
script.onprogress = register_event(env, "on_progress", prefix+".progress");
|
||||
script.onclose = register_event(env, "on_close", prefix+".close");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user