diff --git a/docs/classes/element.html b/docs/classes/element.html index ba53958..b7bde6f 100644 --- a/docs/classes/element.html +++ b/docs/classes/element.html @@ -456,7 +456,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-09 02:01:53 +Last updated 2017-04-09 18:24:55
diff --git a/docs/classes/window.html b/docs/classes/window.html index 7510ea9..3c347ed 100644 --- a/docs/classes/window.html +++ b/docs/classes/window.html @@ -144,7 +144,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-09 02:01:53 +Last updated 2017-04-09 18:24:55
diff --git a/docs/index.html b/docs/index.html index fd405bc..108ed6b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -84,7 +84,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-09 02:01:53 +Last updated 2017-04-09 18:24:55
diff --git a/docs/modules/Element.html b/docs/modules/Element.html index d71248a..4347a25 100644 --- a/docs/modules/Element.html +++ b/docs/modules/Element.html @@ -491,7 +491,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-09 02:01:53 +Last updated 2017-04-09 18:24:55
diff --git a/docs/modules/main.html b/docs/modules/main.html index 35d8039..b7611c8 100644 --- a/docs/modules/main.html +++ b/docs/modules/main.html @@ -105,7 +105,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-09 02:01:53 +Last updated 2017-04-09 18:24:55
diff --git a/docs/modules/pop.html b/docs/modules/pop.html index d9be5ff..85b06f1 100644 --- a/docs/modules/pop.html +++ b/docs/modules/pop.html @@ -723,7 +723,7 @@ table.insert element.parent, element.parent\removeChild(element),
generated by LDoc 1.4.3 -Last updated 2017-04-09 02:01:53 +Last updated 2017-04-09 18:24:55
diff --git a/docs/modules/util.html b/docs/modules/util.html index 3e1857a..60c4ffb 100644 --- a/docs/modules/util.html +++ b/docs/modules/util.html @@ -126,7 +126,7 @@
generated by LDoc 1.4.3 -Last updated 2017-04-09 02:01:53 +Last updated 2017-04-09 18:24:55
diff --git a/elements/element.lua b/elements/element.lua index b02cf3c..4280fc6 100644 --- a/elements/element.lua +++ b/elements/element.lua @@ -116,6 +116,9 @@ do return self end, delete = function(self) + for i = #self.child, 1, -1 do + self.child[i]:delete() + end for i = 1, #self.parent.child do if self.parent.child[i] == self then table.remove(self.parent.child, i) @@ -128,6 +131,8 @@ do break end end + self.parent = nil + self.data.parent = nil end } _base_0.__index = _base_0 diff --git a/elements/element.moon b/elements/element.moon index 6c7a64a..45ae04c 100644 --- a/elements/element.moon +++ b/elements/element.moon @@ -151,9 +151,8 @@ class element --- Deletes references to this element and then deletes it. delete: => - --for i=1, #@child - -- @child[i]\delete! - --@data.child -- for each child, delete its parent ref! + for i=#@child, 1, -1 + @child[i]\delete! for i=1, #@parent.child if @parent.child[i] == @ @@ -165,6 +164,7 @@ class element table.remove @parent.data.child, i break - --@parent = nil - --@data.parent = nil -- really should be for all @data -> nil, and for all @ -> nil - --@ = nil + @parent = nil + @data.parent = nil -- should be for all @ -> nil + --@ = nil <- or that, does that work? Idk + -- DO NOT DELETE @data though, it could still be in use