Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

param remove #887

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -121,7 +121,28 @@ end
function ParamSet:print()
print("paramset ["..self.name.."]")
for k,v in pairs(self.params) do
print(k.." "..v.name.." = "..v:string())
local name = v.name or 'unnamed' -- e.g., separators
print(k.." "..name.." = "..v:string())
end
end

local function get_index(t, val)
for index, v in ipairs (t) do
if (v == val) then
return index
end
end
return nil
end

-- remove.
function ParamSet:remove(id)
local param = self:lookup_param(id)
local index = get_index(self.params, param)
if (index) then
self.count = self.count - 1
self.lookup[id] = nil
table.remove(self.params, index)
end
end

@@ -210,7 +231,7 @@ function ParamSet:write(filename)
print("pset >> write: "..filename)
local fd = io.open(filename, "w+")
io.output(fd)
for k,param in pairs(self.params) do
for _,param in pairs(self.params) do
if param.id and param.t ~= self.tTRIGGER then
io.write(string.format("%s: %s\n", quote(param.id), param:get()))
end
@@ -267,7 +288,7 @@ end

--- bang all params.
function ParamSet:bang()
for k,v in pairs(self.params) do
for _,v in pairs(self.params) do
if v.t ~= self.tTRIGGER then
v:bang()
end
ProTip! Use n and p to navigate between commits in a pull request.