General Question Way to Identify Orbiter Version from within Add-ons (C++ or Lua)?

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
Is there any way to determine under what version of Orbiter (Orbiter 2010, Orbiter 2016, OpenOrbiter, etc..) an add-on has been installed? What I mean is, if I write a Lua script or a C++ module, and certain features will only work with certain versions of Orbiter, that I can get the version information into the code so I can turn on/off features appropriate for the version of Orbiter?
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
Can you see

int oapiGetOrbiterVersion ();
int oapiGetModuleVersion ();

in Lua?
This answers the question for C++, but no, there don't seem to be equivalent methods listed in the Orbiter 2016 Lua documentation, and variants of oapi.get_orbiterversion() don't seem to work.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Is there any way to determine under what version of Orbiter (Orbiter 2010, Orbiter 2016, OpenOrbiter, etc..) an add-on has been installed? What I mean is, if I write a Lua script or a C++ module, and certain features will only work with certain versions of Orbiter, that I can get the version information into the code so I can turn on/off features appropriate for the version of Orbiter?
For all that Versions of Orbiter: No, there isn't a Lua function. And there never will be, as old Versions are ....old ;)
For C++ this API Function has been available for ages (I even believe it is ABI compatible all the way)
For Lua this might be different:
Orbiter 2010: No, not at all
Orbiter 2016: The function is oapi.get_orbiter_version() (although, you might need the DLLs provided here)
OpenOrbiter. Yes (oapi.get_orbiter_version()), so the issue is kind of pointless as we do not provide patches for older versions ;)
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,367
Reaction score
3,302
Points
138
Location
Massachusetts
I've actually sidestepped the function availability issue by simply reading and parsing the Orbiter.log for the version date. That works for any version of Orbiter that generates a log file. If/when Orbiter 2016 is relegated to history the code can be updated to use these functions.
 
Top