How to manipulate RawArray?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PerduGames
:warning: Old Version Published before Godot 3 was released.

I do not understand how I can handle RawArrays.

What do you want to do with them?

raymoo | 2017-07-25 21:06

I wanted to convert RawArray to other types and the opposite also, type a string in a RawArray an int in a RawArray

PerduGames | 2017-07-25 21:14

:bust_in_silhouette: Reply From: raymoo

You can convert a String to RawArray using the to_ascii or to_utf8 methods of String, and you can convert RawArray to String using the get_string_from_ascii and get_string_from_utf8 methods of RawArray.

There is no built-in way to convert between int and RawArray. You could calculate the bytes manually but it would be exceptionally inefficient because you will be doing heavy arithmetic in GDScript.

Converting to string is already fine, because there I only convert the string to int, thank you.

PerduGames | 2017-07-25 21:29