[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Reading & writing an array of numeric data
- From: JK <j.khaldi@...>
- Date: Fri, 12 Mar 2004 12:52:57 +0100
Hi All,
Hi All,
I found this question with many answers regarding the language Ruby. /*
After I do bunch of computations and create a huge array with bunch of
numbers, I like to use the already-computed array in another program
rather than re-computing it each time I run the program. How can I
save the array object in one program and read it from another program
in Ruby?
*/
and I found this answer the simplest one:
You can use marshalling:
array = ...
File.open("array", "wb") do |f|
Marshal.dump(array, f)
end
To reload:
array = nil
File.open("array", "rb") do |f|
array = Marshal.load(f)
end
Now, I need the same thing in Lua. Is it possibile to do this elegantly in
just 8 lines in Lua?
Thanks!
--
jilani