Hi there,
is there a way to figure out whats the ID or Index the current Memory Record?
I know i can use getAddressList().getMemoryRecordByDescription() and so on...
Afaik every Memory Record has a underlaying ID and Index.
Is there a way to get those more or less direct ?
Thanks for useful suggestions
Get ID or Index of current Memory Record
-
- Expert Cheater
- Posts: 242
- Joined: Mon Aug 06, 2018 6:00 pm
- Reputation: 208
Re: Get ID or Index of current Memory Record
getAddressList().getMemoryRecordByDescription(‘description’).ID or .IndexS1N74X wrote: ↑Mon Apr 15, 2024 11:39 amHi there,
is there a way to figure out whats the ID or Index the current Memory Record?
I know i can use getAddressList().getMemoryRecordByDescription() and so on...
Afaik every Memory Record has a underlaying ID and Index.
Is there a way to get those more or less direct ?
Thanks for useful suggestions
[Link]
Re: Get ID or Index of current Memory Record
[/quote]
getAddressList().getMemoryRecordByDescription(‘description’).ID or .Index
[/quote]
Thx for your reply but thats exatctly not the way i need to get the ID or the Index
The Memerc Name or Description can change. The ID is afaik uniqe
getAddressList().getMemoryRecordByDescription(‘description’).ID or .Index
[/quote]
Thx for your reply but thats exatctly not the way i need to get the ID or the Index
The Memerc Name or Description can change. The ID is afaik uniqe
-
- Expert Cheater
- Posts: 242
- Joined: Mon Aug 06, 2018 6:00 pm
- Reputation: 208
Re: Get ID or Index of current Memory Record
Does it. Thximjustmaxie wrote: ↑Mon Apr 15, 2024 1:53 pmgetAddressList().SelectedRecord.ID or getAddressList().SelectedRecord.Index
Re: Get ID or Index of current Memory Record
Aah sh.....S1N74X wrote: ↑Mon Apr 15, 2024 2:00 pmDoes it. Thximjustmaxie wrote: ↑Mon Apr 15, 2024 1:53 pmgetAddressList().SelectedRecord.ID or getAddressList().SelectedRecord.Index
Selected == Activated
So the result doesnt match if you activate more than one script
Thx anyway
-
- Expert Cheater
- Posts: 242
- Joined: Mon Aug 06, 2018 6:00 pm
- Reputation: 208
Re: Get ID or Index of current Memory Record
Use a for loop on the AddressList and do compares if the AddressList[/i].Selected == true or AddressList[/i].Active == true or not, and do what you want to do afterwards.S1N74X wrote: ↑Mon Apr 15, 2024 2:10 pmAah sh.....S1N74X wrote: ↑Mon Apr 15, 2024 2:00 pmDoes it. Thximjustmaxie wrote: ↑Mon Apr 15, 2024 1:53 pm
getAddressList().SelectedRecord.ID or getAddressList().SelectedRecord.Index
Selected == Activated
So the result doesnt match if you activate more than one script
Thx anyway
Code: Select all
local al = getAddressList()
for i=0,al.Count-1 do
if al[i].Selected == true then
-- code here
end
-- or
if al[i].Active == true then
-- code here
end
end
Re: Get ID or Index of current Memory Record
^^ or: myMr = al.getMemoryRecordByID(ID)
(i never/rarely work with 'byDescr...' since i tend to a) rearrange/rename my entries in due time b) copy/pasting from another table keeps thàt ID (unless it already exists in current table)
(i never/rarely work with 'byDescr...' since i tend to a) rearrange/rename my entries in due time b) copy/pasting from another table keeps thàt ID (unless it already exists in current table)
-
- Noobzor
- Posts: 14
- Joined: Mon Sep 18, 2023 10:09 pm
- Reputation: 1
Re: Get ID or Index of current Memory Record
Code: Select all
[ENABLE]
-- Do Stuff
ID.Active = false
[DISABLE]
Re: Get ID or Index of current Memory Record
Here's one way you can do it:
This does not account for any error-checking though.
Code: Select all
local function getSelectedRecordIDs()
local tmp = {}
for i = 0, AddressList.Count - 1 do
if AddressList[i].Selected then
table.insert(tmp, AddressList[i].ID)
end
end
return tmp
end
local function getSelectedRecordID()
local selectedRecord = AddressList.SelectedRecord
local ID = selectedRecord.ID
local Description = selectedRecord.Description
return ID, Description
end
-- Print single selected record ID
local id, desc = getSelectedRecordID()
printf('Description: %s\t- ID: %d', desc, id)
----------------------------------------------------------------------
-- Print ID of multiple selected recrods
local selectedIDs = getSelectedRecordIDs()
for k,v in pairs(selectedIDs) do
print('Selected IDs: ' .. v)
end
----------------------------------------------------------------------
Who is online
Users browsing this forum: No registered users