Fix in Container and added Program:stop()

This commit is contained in:
Robert Jelic
2025-05-10 23:41:05 +02:00
parent f04cdb448b
commit f7c4165aa4
2 changed files with 14 additions and 0 deletions

View File

@@ -301,6 +301,7 @@ end
--- @param child table The child to remove
--- @return Container self The container instance
function Container:removeChild(child)
if child == nil then return self end
for i,v in ipairs(self._values.children) do
if v.get("id") == child.get("id") then
table.remove(self._values.children, i)

View File

@@ -184,6 +184,19 @@ function Program:execute(path, env, addEnvironment)
return self
end
--- Stops the program
--- @shortDescription Stops the program
--- @return Program self The Program instance
function Program:stop()
local program = self.get("program")
if program then
program:stop()
self.set("running", false)
self.set("program", nil)
end
return self
end
--- Sends an event to the program
--- @shortDescription Sends an event to the program
--- @param event string The event to send