Commits

Anonymous committed 1299db5

Added support for boolean objects True and False (with /bool indicator)

  • Participants
  • Parent commits 71c92cd

Comments (0)

Files changed (3)

File EXAMPLE_CONFIG

 
 [general]
 player_name = toaster_phun
+professional/bool = False
 age/int = 19
 
 [connection]
 [bank]
 balance/int = 3000
 profit/float = .02
+is_active/bool = True
 
 	player_age/float = 19
 	
+Or a boolean:
+
+	apply_advanced_graphics/bool = True
+	
+	### Warning ###
+	Boolean values should only be "True" or "False". Anything besides False will be returned as True. (So don't misspell False!)
+	
 	
 API Changes since 1.x
 ---------------------
 			"str": str,
 			"string": str,
 			"fl": float,
-			"float": float
+			"float": float,
+			"bool": bool
 			}
 			
 		# name should either be 'name' or 'name/int' (& variations)
 		if '/' in name:
 			name = name.split("/")
 			# find out what the type is,
-			# convert, return
+			# assign function to x, return
 			x = types[name[1].strip()]
 			
+			# False will be True (because it's a string w/ text)
+			# Fix
+			if name[1].strip() == "bool" and value.strip() == "False": return False
 			return x(value)
 		
 		else:
+			# return default datatype (string)
 			return str(value).strip()