Skip to content

Commit

Permalink
add callbacks for reading/writing parameters (#1326)
Browse files Browse the repository at this point in the history
add callbacks for reading/writing parameters
  • Loading branch information
schollz authored Mar 14, 2021
1 parent b1d5b00 commit e68cdf4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lua/core/paramset.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function ParamSet.new(id, name)
ps.hidden = {}
ps.lookup = {}
ps.group = 0
ps.action_write = nil
ps.action_read = nil
ParamSet.sets[ps.id] = ps
return ps
end
Expand Down Expand Up @@ -379,6 +381,9 @@ function ParamSet:write(filename, name)
end
end
io.close(fd)
if self.action_write ~= nil then
self.action_write(filename,name)
end
else print("pset: BAD FILENAME") end
end

Expand Down Expand Up @@ -420,6 +425,9 @@ function ParamSet:read(filename, silent)
end
end
end
if self.action_read ~= nil then
self.action_read(filename,silent)
end
else
print("pset :: "..filename.." not read.")
end
Expand All @@ -445,6 +453,8 @@ function ParamSet:clear()
self.name = ""
self.params = {}
self.count = 0
self.action_read = nil
self.action_write = nil
end

return ParamSet

0 comments on commit e68cdf4

Please sign in to comment.