add data argument to container:add(...)

This commit is contained in:
MihailRis
2025-04-24 22:42:15 +03:00
parent 9befbb9795
commit 8e8cabf2d1
3 changed files with 26 additions and 1 deletions
+9 -1
View File
@@ -83,8 +83,16 @@ static int l_container_add(lua::State* L) {
}
auto xmlsrc = lua::require_string(L, 2);
try {
auto env = docnode.document->getEnvironment();
if (lua::istable(L, 3)) {
env = create_environment(std::move(env));
lua::pushenv(L, *env);
lua::pushvalue(L, 3);
lua::setfield(L, "DATA");
lua::pop(L);
}
auto subnode = guiutil::create(
engine->getGUI(), xmlsrc, docnode.document->getEnvironment()
engine->getGUI(), xmlsrc, std::move(env)
);
node->add(subnode);
UINode::getIndices(subnode, docnode.document->getMapWriteable());