| View previous topic :: View next topic |
| Author |
Message |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3327
|
Posted: Sun Aug 25, 2024 2:29 pm Post subject: How to delete a Global Structure? |
|
|
I created a structure using:
| Code: | myStructure = createStructure(sStructureName)
myStructure.addToGlobalStructureList()
|
Now I'd like to delete it:
| Code: | myStructure = getStructure(index)
myStructure.removeFromGlobalStructureList()
deleteStructure(myStructure) <= does not exist
|
Any ideas?
Thank you!
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25807 Location: The netherlands
|
Posted: Sun Aug 25, 2024 2:32 pm Post subject: |
|
|
myStructure.destroy()
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3327
|
Posted: Sun Aug 25, 2024 2:42 pm Post subject: |
|
|
That was too easy, thanks!
Suppose I don't want to destroy the whole thing, I just want to wipe it.
Is there an easy way to remove all elements? (without a destroy loop?)
The Count property is read-only, so setting that to zero does not work.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25807 Location: The netherlands
|
Posted: Sun Aug 25, 2024 2:53 pm Post subject: |
|
|
Nope, got to destroy all the elements using a loop
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3327
|
Posted: Mon Aug 26, 2024 8:33 am Post subject: |
|
|
These (while and for loops) do not seem to wipe the structure (neither one).
| Code: |
function fn_WipeStructureElements(sourceStructure)
if sStructureName==nil or sStructureName=="" then return nil end
while sourceStructure.Count>0 do sourceStructure.Element[0].destroy() end
-- for i=sourceStructure.Count-1, 0, -1 do
-- sourceStructure.Element[i].destroy()
-- end
end
|
What am I missing?
Thank you!
|
|
| Back to top |
|
 |
|