|
|
@@ -17,7 +17,7 @@ end |
|
|
|
function ed.bfunc:save(fpath) |
|
|
|
local path = fpath or self.path |
|
|
|
if not path then return false, "no path" end |
|
|
|
self.path = path |
|
|
|
self.path = path |
|
|
|
local f = io.open(path,"wb") |
|
|
|
if not f then return false, "unable to open file" end |
|
|
|
for k,v in ipairs(self) do |
|
|
@@ -112,6 +112,7 @@ function ed.newBuffer() |
|
|
|
end |
|
|
|
|
|
|
|
function ed.open(buffer) |
|
|
|
local bpath = buffer |
|
|
|
if ed.buffers[buffer] then |
|
|
|
buffer = ed.buffers[buffer] |
|
|
|
end |
|
|
@@ -120,7 +121,9 @@ function ed.open(buffer) |
|
|
|
nb:load(buffer) |
|
|
|
buffer = nb |
|
|
|
end |
|
|
|
if type(buffer) ~= "table" then buffer = ed.newBuffer() buffer[1] = "" end |
|
|
|
if type(buffer) ~= "table" then buffer = ed.newBuffer() end |
|
|
|
buffer[1] = buffer[1] or "" |
|
|
|
buffer.path = buffer.path or bpath |
|
|
|
return buffer |
|
|
|
end |
|
|
|
|
|
|
|