Table of Contents
This is an old revision of the document!
Tostring
We can turn matrix objects to strings. This allows one to print matrices. One can however also change the format of the string before printing a matrix
Example
Here we change the curly brackets {,} to straight brackets [,].
Input
- Example.Quanty
A = Matrix.New({{1,2},{3,4}}) AStr = tostring(A) BStr = string.gsub(AStr, "{", "[") BStr = string.gsub(BStr, "}", "]") print(BStr)
Result
[ [ 1 , 2 ] , [ 3 , 4 ] ]