I only have one “gui.delete_node” in my whole script, and it’s here:
code
for k,v in ipairs(self.keyframes) do
--print(k,v)
if k == self.uniquekeyframeidentifier then
gui.delete_node(v)
self.keyframes[k] = nil
self.uniquekeyframeidentifier = nil
print(self.keyframes[k])
break
end
end
As i understand I delete the node and then the reference to the node in the table.
But later, when I try and print the table, I get an Deleted Node error message.
I’ve added a line in “on_input” that says “pprint(self.keyframes)” and it works fine all the time
and if i run the code below
gui.delete_node(self.keyframes[self.uniquekeyframeidentifier])
self.keyframes[self.uniquekeyframeidentifier] = nil
self.uniquekeyframeidentifier = nil
pprint(self.keyframes)
for k,v in pairs(self.keyframes) do
print(v)
end
that also works okay, no errors. But as soon as I move the mouse at all, and on_input is triggered, I get the error message saying that there’s a deleted node. I have no update and no other functions firing.
The project is very simple, just 274 lines of very simple code inside a GUI script called guiscript2.guiscript. And as I say, there’s only one gui.delete_node, so if anyone wants to have a look, it’s here:
Ah! Sorry. The red diamonds that appear on the left of the screen represent keyframes on timelines. If you click on one of the ones in the middle then press backspace, you delete that node (and the reference to the node which is in the table). That’s when the problem starts. Thank you and sorry!
And I’m trying to delete the entry at index 2. And the node at index 2 also exists at index 3! I’m guessing that you are manipulating the list when a keyframe node is selected and somehow insert the same node again?