View previous topic :: View next topic |
Author |
Message |
salumor Advanced Cheater
Reputation: 0
Joined: 14 Jan 2019 Posts: 87
|
Posted: Thu Apr 11, 2024 8:25 am Post subject: Updating structure offsets |
|
|
Is there any option to temporary disable structure updates? (there is only beginUpdate() resp. end to make it even faster but i'd like to ... stop and continue)
Else is there any convinient method to update structure offsets rather than ... thinking a about a rly complex method for the correct logical order.
What I actually have is a table read from memory that I try to match with my structure, but it's a complete mess (not as simple as example below) so I can only check on IDs. But the problem is, that once I go through the table and update an offset the table indexes wont match the ones in the struct so .... uff.
Easy example:
Code: | --create structure from 0 to 10
local struct=createStructure("test")
for i=0,10 do
local el = struct.addElement()
el.Name=tostring(i)
el.Offset=i*16
el.VarType=2 --vtDword
el.DisplayMethod='dtSignedInteger'
print(i,el.Name,el.Offset)
end
--change offsets in reverse order
for i=0,10 do
local el = struct.Element[i]
el.Offset=(10-i)*16
print(i,el.Name,el.Offset)
end
struct.addToGlobalStructureList()
createStructureForm(0, nil, "test") |
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25804 Location: The netherlands
|
Posted: Thu Apr 11, 2024 10:06 am Post subject: |
|
|
create a lua table to hold all the elements and then go through there
_________________
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 |
|
 |
salumor Advanced Cheater
Reputation: 0
Joined: 14 Jan 2019 Posts: 87
|
Posted: Thu Apr 11, 2024 10:19 am Post subject: |
|
|
You mean I simply have to make sure to have everything I need in table, destroy that structure or elements (and if wanted create a new one)?
So there is no way around structures auto-resorting based on offsets?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25804 Location: The netherlands
|
Posted: Thu Apr 11, 2024 10:46 am Post subject: |
|
|
just a lua table. {}
put e into a table after creating the elements and when you wish to mass edit stuff use that table for indexes
in the example:
Code: |
--create structure from 0 to 10
local t
local struct=createStructure("test")
for i=0,10 do
local el = struct.addElement()
el.Name=tostring(i)
el.Offset=i*16
el.VarType=2 --vtDword
el.DisplayMethod='dtSignedInteger'
t[i+1]=el
print(i,el.Name,el.Offset)
end
--change offsets in reverse order
for i=0,10 do
local el = t[i+1]
el.Offset=(10-i)*16
print(i,el.Name,el.Offset)
end
struct.addToGlobalStructureList()
createStructureForm(0, nil, "test")
|
_________________
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 |
|
 |
salumor Advanced Cheater
Reputation: 0
Joined: 14 Jan 2019 Posts: 87
|
Posted: Thu Apr 11, 2024 11:39 am Post subject: |
|
|
Ah ok. Thanks, now I got it!
I do wonder how it works, that structures are updated and a table referencing not. But yeah, this is what I wanted.
(for anyone reading it too: ofc its "local t={}")
|
|
Back to top |
|
 |
|