Skip to content

Commit f7c4165

Browse files
committed
Fix in Container and added Program:stop()
1 parent f04cdb4 commit f7c4165

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/elements/Container.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ end
301301
--- @param child table The child to remove
302302
--- @return Container self The container instance
303303
function Container:removeChild(child)
304+
if child == nil then return self end
304305
for i,v in ipairs(self._values.children) do
305306
if v.get("id") == child.get("id") then
306307
table.remove(self._values.children, i)

src/elements/Program.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,19 @@ function Program:execute(path, env, addEnvironment)
184184
return self
185185
end
186186

187+
--- Stops the program
188+
--- @shortDescription Stops the program
189+
--- @return Program self The Program instance
190+
function Program:stop()
191+
local program = self.get("program")
192+
if program then
193+
program:stop()
194+
self.set("running", false)
195+
self.set("program", nil)
196+
end
197+
return self
198+
end
199+
187200
--- Sends an event to the program
188201
--- @shortDescription Sends an event to the program
189202
--- @param event string The event to send

0 commit comments

Comments
 (0)