Skip to content

[FeatureRequest]: Function to save array to a file. #951

@owendare

Description

@owendare

Is your feature request related to a problem? Please describe.

it would be good if you could write an array to file in a format that was compatible with fileread()
At present to achieve this requires something like the macro below because if you use echo >"0:/sys/myArray.csv" {var.myArray} , the created file include the curly brackets which cause fileread{} to choke.

var myString = ""
while iterations < #var.myArray
    set var.myString = var.myString ^ """" ^ var.myArray[iterations] ^ """" ^ ","
echo >"0:/macros/conditional_g_code_macros/myArray.csv" var.myString
var readBackArray = fileread("0:/macros/conditional_g_code_macros/myArray.csv",0,{#var.myArray},',')
echo var.readBackArray
echo var.readBackArray[0] ^ " : " ^ var.readBackArray[#var.readBackArray-1]```



### Describe the solution you propose.

Apparent choices are..
1.  Modify echo> command to strip curly brackets from arrays before saving to file.
2.  Create dedicated function to save arrays to file.
Option 1 would seem more logical.


### Describe alternatives you've considered

Perhaps fileread() can strip the curly brackets if present?
This would save having a new function to write the array to file.


### Provide any additional context or information.

Ex. Photos, mockups, etc.

Metadata

Metadata

Assignees

Labels

enhancementAdditional functionality, performance or other feature request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions