Hello, I am currently on the task to implement a way to import a saved table into an existing one. This looks quite promising, but the mechanism fails if there is only one entry in an table which is suposed to be imported.
Further observations: It is only possible to import projects which are smaller than the current one. NationCount grows to the number of ImpNationCount and not further. It skips the first entry if there are more than one entry.
The part where the error jumps in is: The script jumps into an error when accessing "t_IMPnation[1]" when i = 0 and ImpNationCount = 1
Code: Select all
Function p_ExecImport()
Global imported = 0
;Nation
If ImpNationCount > 0
DebugPrint("ImpNC:..",ImpNationCount)
DebugPrint("NC:..", NationCount)
For i = 0 To (ImpNationCount-1)
DebugPrint("NC..",NationCount)
DebugPrint("i..", i)
p_defTab(t_nation, NationCount,NationCount+1, 1)
newid = p_CreateID()
t_nation[NationCount][0]= newid
t_nation[NationCount][1]= t_IMPnation[i][1]
t_impRef[imported][0] = t_IMPnation[i][0]
t_impRef[imported][1] = newid
imported = Add(imported, 1)
NationCount = Add(NationCount,1)
Next
EndIf()