lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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