Hello all,
I hate to ask for help with something that seems to basic but LUA and I do not get along and despite looking through the LUA documentation and these threads I'm still drawing blanks.
I created a number of reference points (RPs) to plan out a course for a task group but now I realise that I saved the file under a different name and have since added to the older version - thereby making it the newer version (still with me?).
Unfortunately, this means that I no longer have those RPs that I placed to plan that course. However, I do still have the old file.
I need a piece of code that I can use to get the lat / longs of the RPs (named "AA" through to "QQ") from the outdated file and then recreate them in the updated version.
So far, I've tried:
Code: Select all
local Waypoints = ScenEdit_GetReferencePoints( { side="Royal Navy", area={ "AA", "BB", "CC", "DD", "EE", "FF", "GG", "HH", "II", "JJ", "KK", "LL", "MM", "NN", "OO", "PP", "QQ"} } )
PRINT (Waypoints.lattitude)
PRINT (Waypoints.longitude)
Code: Select all
ERROR: [string "Console"]:2: attempt to call a nil value (global 'PRINT')
Code: Select all
local Waypoints = ScenEdit_GetReferencePoints( { side="Royal Navy", area={ "AA", "BB", "CC", "DD", "EE", "FF", "GG", "HH", "II", "JJ", "KK", "LL", "MM", "NN", "OO", "PP", "QQ"} } )
PRINT (Waypoints.lattitude)
PRINT.(Waypoints.longitude)
Code: Select all
ERROR: [string "Console"]:2: <name> expected near '('
SOLUTION:
Disregard, all. It seems that I missed what was almost literally under my nose last night.
In order to acheive what I wanted, I found this piece of code written by KnightHawk75:
Thank you KnightHawk for being something of a genius in terms of LUA.KnightHawk75 wrote:Code: Select all
local rps = ScenEdit_GetReferencePoints({side='<Side_Name>', area={'RefPoint_1','RefPoint_2','etc'}}); if rps~= nil then for idx,rp in ipairs(rps) do print("Name: ".. rp.name.. " Lat: " .. rp.latitude .." Lon: " .. rp.longitude); end end