Window API under CC1.58 & earlier
Started by Hiran, Oct 01 2014 11:44 PM
4 replies to this topic
#1
Posted 01 October 2014 - 11:44 PM
Window api appeared in CC1.6 but will it work if I copy its file to 1.58 version? I need that info for my newest idea
#2
Posted 02 October 2014 - 12:11 AM
Similar APIs have been used since well before 1.58, so unless it depends on CC1.6-specific features from the Java side of things, it should probably work fine.
#3
Posted 02 October 2014 - 12:14 AM
It should work fine, though you might need to remove the code that checks if parent == term (the code bellow), since I don't think earlier versions of CC had term.current
if parent == term then error( "term is not a recommended window parent, try term.current() instead", 2 ) end
#4
Posted 02 October 2014 - 08:47 AM
natedogith1, on 02 October 2014 - 12:14 AM, said:
It should work fine, though you might need to remove the code that checks if parent == term (the code bellow), since I don't think earlier versions of CC had term.current
if parent == term then error( "term is not a recommended window parent, try term.current() instead", 2 ) end
And after analyzing window API i went like
#5
Posted 02 October 2014 - 09:29 AM
indeed there is. os.version will do the trick. In Lua you can compare strings in some powerful ways
local version = os.version() if version < "CraftOS 1.6" then --# Version before CC 1.6 elseif version > "CraftOS 1.6" then --# Version after CC 1.6 else --# ComputerCraft 1.6 endyou could also just check if certain APIs are nil too.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











