add on_screen_change project script event & fix UIDocument::rebuildIndices & move menu background to project script

This commit is contained in:
MihailRis
2025-08-07 22:14:52 +03:00
parent 7749da4a85
commit 0a02d3fbec
16 changed files with 148 additions and 66 deletions
+5 -2
View File
@@ -79,9 +79,12 @@ static int l_textbox_paste(lua::State* L) {
static int l_container_add(lua::State* L) {
auto docnode = get_document_node(L);
if (docnode.document == nullptr) {
throw std::runtime_error("target document not found");
}
auto node = dynamic_cast<Container*>(docnode.node.get());
if (node == nullptr) {
return 0;
throw std::runtime_error("target container not found");
}
auto xmlsrc = lua::require_string(L, 2);
try {
@@ -99,7 +102,7 @@ static int l_container_add(lua::State* L) {
UINode::getIndices(subnode, docnode.document->getMapWriteable());
node->add(std::move(subnode));
} catch (const std::exception& err) {
throw std::runtime_error(err.what());
throw std::runtime_error("container:add(...): " + std::string(err.what()));
}
return 0;
}
+1 -5
View File
@@ -58,12 +58,8 @@ static void create_libs(State* L, StateType stateType) {
openlib(L, "vec4", vec4lib);
openlib(L, "yaml", yamllib);
if (stateType == StateType::SCRIPT) {
openlib(L, "app", applib);
} else if (stateType == StateType::BASE) {
openlib(L, "__vc_app", applib);
}
if (stateType == StateType::BASE || stateType == StateType::SCRIPT) {
openlib(L, "__vc_app", applib);
openlib(L, "assets", assetslib);
openlib(L, "audio", audiolib);
openlib(L, "console", consolelib);