How would I convert a string to an array, and an array to a string again?
Something along the lines of:
@enemy_data = [1, 2, 3, 4]
@enemy_data.to_string # returns "1|2|3|4"
@enemy_data.to_array = # returns [1, 2, 3, 4]
I know .to_s and .to_a exist, but I'm not sure they work for what I want to do. .to_s and .to_a would do:
@enemy_data = [1, 2, 3, 4]
@enemy_data.to_s # returns "1234"
@enemy_data.to_a = # returns ["1234"]
Something along the lines of:
@enemy_data = [1, 2, 3, 4]
@enemy_data.to_string # returns "1|2|3|4"
@enemy_data.to_array = # returns [1, 2, 3, 4]
I know .to_s and .to_a exist, but I'm not sure they work for what I want to do. .to_s and .to_a would do:
@enemy_data = [1, 2, 3, 4]
@enemy_data.to_s # returns "1234"
@enemy_data.to_a = # returns ["1234"]