* addressing an interior array

For plugin authors to discuss plugin programming
Post Reply
User avatar
Ron Melby
Megastar
Posts: 928
Joined: 15 Nov 2016 15:40
Family Historian: V6.2

addressing an interior array

Post by Ron Melby »

I am once again flummoxed.

I am trying to find and correct errors in my gravesites.
I find them and have them in GEDRCD
I then strip out the memmorial id from gravminer, digitalarkkivet or findagrave.
now I want to look for duplicates:

for k, _ in ipairs(GEDRCD) do
this = GEDRCD[k]
_dup[this.MML] = _dup[this.MML] or {rrn = {}}
_dup[this.MML].rrn[#rrn + 1] = this <<<< statement in error
end
error: attempt to get length of global 'rrn' (a nil value)
_dup[123456789]. rrn= { } at the error

I am improving somewhat, because I recognize I have had this error before and MikeTate helped me thru it:

--[[
object = famOBJ[#famOBJ].CHIL
local instance = #famOBJ[#famOBJ].CHIL
object[instance + 1] = c_iID
]]
famOBJ[#famOBJ].CHIL[#famOBJ[#famOBJ].CHIL + 1] = c_iID
_dup[this.MML].rrn(*miracle occurs here*) [#rrn + 1] = this
I intend to make an array of every record number of my gedcom array (this) in rrn array

if there is only one record in the array when done processing I get rid of it. this will result in an empty _dup or a _dup with multiple records... viola, duplicates.

I have tried a multitude of combinations and brackets but not really understanding it, having walked thru it in my mind and not connected with it a billion times..... I am still at a loss
FH V.6.2.7 Win 10 64 bit
User avatar
tatewise
Megastar
Posts: 28436
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: addressing an interior array

Post by tatewise »

Try:
_dup[this.MML].rrn[#_dup[this.MML].rrn+1] = this
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Post Reply