11:15:39 AM Nov 06
#!/usr/bin/env lua
local Gnuplot = { }
function Gnuplot:init()
self.gp = io.popen("gnuplot", "w")
end
function Gnuplot:write(cmd)
self.gp:write(cmd, "\n")
self.gp:flush()
end
function Gnuplot:close()
self.gp:close()
end
return Gnuplot#!/usr/bin/env lua
home = os.getenv("HOME")
package.path = string.format("%s/Dropbox/codes/Gnuplot.lua/Gnuplot.lua", home)
gp = require "Gnuplot"
-- Start Gnuplot...
gp:init()
-- Gnuplot commands...
gp:write("plot sin(x)")
-- For display purpose
io.write("Press enter to exit...")
io.read()
-- Close Gnuplot...
gp:close()