mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 06:51:51 +00:00
feat: it's not breaking change if it never worked
This commit is contained in:
parent
63f2751910
commit
fe69d31f97
3 changed files with 6 additions and 5 deletions
|
|
@ -139,7 +139,7 @@ gui.confirm(
|
||||||
## Documents and templates
|
## Documents and templates
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- Loads a UI document with its script, returns the name of the document if successfully loaded.
|
-- Loads a UI document with its script. Returns document environment table
|
||||||
gui.load_document(
|
gui.load_document(
|
||||||
-- Path to the xml file of the page. Example: `core:layouts/pages/main.xml`
|
-- Path to the xml file of the page. Example: `core:layouts/pages/main.xml`
|
||||||
path: str,
|
path: str,
|
||||||
|
|
@ -147,7 +147,7 @@ gui.load_document(
|
||||||
name: str
|
name: str
|
||||||
-- Table of parameters passed to the on_open event
|
-- Table of parameters passed to the on_open event
|
||||||
args: table
|
args: table
|
||||||
) -> str
|
) -> table
|
||||||
|
|
||||||
-- Loads and processes layout template from file
|
-- Loads and processes layout template from file
|
||||||
gui.template(
|
gui.template(
|
||||||
|
|
|
||||||
|
|
@ -140,12 +140,12 @@ gui.confirm(
|
||||||
## Документы и шаблоны
|
## Документы и шаблоны
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- Загружает UI документ и его скрипт. Возвращает имя документа.
|
-- Загружает UI документ и его скрипт. Возвращает пространство имён документа
|
||||||
gui.load_document(
|
gui.load_document(
|
||||||
path: string, -- путь к xml файлу, например: core:layouts/pages/main.xml
|
path: string, -- путь к xml файлу, например: core:layouts/pages/main.xml
|
||||||
name: string, -- id документа, например: core:pages/main
|
name: string, -- id документа, например: core:pages/main
|
||||||
args: table -- параметры для события on_open
|
args: table -- параметры для события on_open
|
||||||
) -> string
|
) -> table
|
||||||
|
|
||||||
-- Обрабатывает xml шаблон макета из файла
|
-- Обрабатывает xml шаблон макета из файла
|
||||||
gui.template(
|
gui.template(
|
||||||
|
|
|
||||||
|
|
@ -1127,6 +1127,7 @@ static int l_gui_load_document(lua::State* L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto env = scripting::create_doc_environment(parentEnv, alias);
|
auto env = scripting::create_doc_environment(parentEnv, alias);
|
||||||
|
auto envId = *env;
|
||||||
// namespace extension
|
// namespace extension
|
||||||
if (lua::istable(L, 4)) {
|
if (lua::istable(L, 4)) {
|
||||||
if (lua::get_from(L, "table", "extend")) {
|
if (lua::get_from(L, "table", "extend")) {
|
||||||
|
|
@ -1148,7 +1149,7 @@ static int l_gui_load_document(lua::State* L) {
|
||||||
engine->requireAssets().store(std::move(documentPtr), alias);
|
engine->requireAssets().store(std::move(documentPtr), alias);
|
||||||
|
|
||||||
scripting::on_ui_open(*document, {args});
|
scripting::on_ui_open(*document, {args});
|
||||||
return 0;
|
return lua::pushenv(L, envId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_set_syntax_styles(lua::State* L) {
|
static int l_set_syntax_styles(lua::State* L) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue