mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Add String char(int ascii) function to GDScript and Visual Script
				
					
				
			Just hope it doesn't crashes with that much pointer math... 😄
			
			
This commit is contained in:
		
							parent
							
								
									78d97b060a
								
							
						
					
					
						commit
						513c0265c4
					
				
					 4 changed files with 34 additions and 0 deletions
				
			
		|  | @ -88,6 +88,7 @@ const char *GDFunctions::get_func_name(Function p_func) { | |||
| 		"convert", | ||||
| 		"typeof", | ||||
| 		"type_exists", | ||||
| 		"char", | ||||
| 		"str", | ||||
| 		"print", | ||||
| 		"printt", | ||||
|  | @ -538,6 +539,12 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va | |||
| 			r_ret = ObjectTypeDB::type_exists(*p_args[0]); | ||||
| 
 | ||||
| 		} break; | ||||
| 		case TEXT_CHAR: { | ||||
| 			VALIDATE_ARG_COUNT(1); | ||||
| 			VALIDATE_ARG_NUM(0); | ||||
| 			CharType result[2] = {*p_args[0], 0}; | ||||
| 			r_ret=String(result); | ||||
| 		} break; | ||||
| 		case TEXT_STR: { | ||||
| 
 | ||||
| 			String str; | ||||
|  | @ -1133,6 +1140,7 @@ bool GDFunctions::is_deterministic(Function p_func) { | |||
| 		case TYPE_CONVERT: | ||||
| 		case TYPE_OF: | ||||
| 		case TYPE_EXISTS: | ||||
| 		case TEXT_CHAR: | ||||
| 		case TEXT_STR: | ||||
| 		case COLOR8: | ||||
| // enable for debug only, otherwise not desirable - case GEN_RANGE:
 | ||||
|  | @ -1402,6 +1410,13 @@ MethodInfo GDFunctions::get_info(Function p_func) { | |||
| 			mi.return_val.type=Variant::BOOL; | ||||
| 			return mi; | ||||
| 
 | ||||
| 		} break; | ||||
| 		case TEXT_CHAR: { | ||||
| 
 | ||||
| 			MethodInfo mi("char",PropertyInfo(Variant::INT,"ascii")); | ||||
| 			mi.return_val.type=Variant::STRING; | ||||
| 			return mi; | ||||
| 
 | ||||
| 		} break; | ||||
| 		case TEXT_STR: { | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Bojidar Marinov
						Bojidar Marinov