mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add gui.load_document namespace extension table argument & pass app library from standard pages loader
This commit is contained in:
parent
d6b6c6903a
commit
e794aa864d
2 changed files with 11 additions and 1 deletions
|
|
@ -34,7 +34,7 @@ function gui_util.load_page(query)
|
|||
local filename = file.find(string.format("layouts/pages/%s.xml", name))
|
||||
if filename then
|
||||
name = file.prefix(filename)..":pages/"..name
|
||||
gui.load_document(filename, name, args)
|
||||
gui.load_document(filename, name, args, { app = __vc_app })
|
||||
return name
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1111,6 +1111,16 @@ static int l_gui_load_document(lua::State* L) {
|
|||
);
|
||||
auto document = documentPtr.get();
|
||||
engine->getAssets()->store(std::move(documentPtr), alias);
|
||||
|
||||
// namespace extension
|
||||
if (lua::istable(L, 4)) {
|
||||
if (lua::get_from(L, "table", "merge")) {
|
||||
lua::pushenv(L, *document->getEnvironment());
|
||||
lua::pushvalue(L, 4);
|
||||
lua::call(L, 2, 0);
|
||||
lua::pop(L);
|
||||
}
|
||||
}
|
||||
scripting::on_ui_open(document, {args});
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue