Jump to content




Window API under CC1.58 & earlier


  • You cannot reply to this topic
4 replies to this topic

#1 Hiran

  • Members
  • 44 posts

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 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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 natedogith1

  • Members
  • 110 posts

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 Hiran

  • Members
  • 44 posts

Posted 02 October 2014 - 08:47 AM

View Postnatedogith1, 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
Is there any way to check which version of CC im working with?
And after analyzing window API i went like :o I can use OOP here :) Give me some time and you will see really powerful button API with PDA support and whatnot :)

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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
end
you could also just check if certain APIs are nil too.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users