Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to delete a Global Structure?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3327

PostPosted: Sun Aug 25, 2024 2:29 pm    Post subject: How to delete a Global Structure? Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25807
Location: The netherlands

PostPosted: Sun Aug 25, 2024 2:32 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3327

PostPosted: Sun Aug 25, 2024 2:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25807
Location: The netherlands

PostPosted: Sun Aug 25, 2024 2:53 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3327

PostPosted: Mon Aug 26, 2024 8:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites