aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Richter <vrld@vrld.org>2013-01-23 12:32:16 +0100
committerMatthias Richter <vrld@vrld.org>2013-01-23 12:32:16 +0100
commitc1d743ddbd84a439cefc6c7d32155ea405e8da4a (patch)
tree194be55fbb278ad2dac28e7f0d86e62a6bc459e4
parent6f46983115ed2560e76b1f86fa4dd10ed21a3162 (diff)
downloadQuickie-c1d743ddbd84a439cefc6c7d32155ea405e8da4a.tar.gz
Quickie-c1d743ddbd84a439cefc6c7d32155ea405e8da4a.tar.bz2
Quickie-c1d743ddbd84a439cefc6c7d32155ea405e8da4a.tar.xz
Quickie-c1d743ddbd84a439cefc6c7d32155ea405e8da4a.zip
Add gui.group{arguments-gui.group.push, func}.
Convenience function that wraps func() in a push/pop pair, i.e. gui.group{grow=grow, spacing=spacing, size=size, pos=pos, function() do_stuff() end} is equivalent to gui.group.push{grow=grow, spacing=spacing, size=size, pos=pos} do_stuff() gui.group.pop()
-rw-r--r--group.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/group.lua b/group.lua
index 50e413e..4889cd4 100644
--- a/group.lua
+++ b/group.lua
@@ -138,6 +138,14 @@ return setmetatable({
beginFrame = beginFrame,
endFrame = endFrame,
default = default,
-}, {__index = function(_,k)
- return ({size = current.size, pos = current.pos})[k]
-end})
+}, {
+ __index = function(_,k)
+ return ({size = current.size, pos = current.pos})[k]
+ end,
+ __call = function(_, info)
+ assert(type(info) == 'table' and type(info[1]) == 'function')
+ push(info)
+ info[1]()
+ pop()
+ end,
+})