[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Configuration file rewrite
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Wed, 21 Dec 2011 14:38:55 +0100
2011/12/21 Sime Ramov <s@ramov.com>:
> Any ideas to make it better, i.e. maybe some clever use of tables or
> some higher order functions etc?
I attached an example of what you can do with very little work. I
didn't test it since I don't have that window manager, but it should
be easy to make it run.
"hc" became a table rather than a function, and instead of calling
hc("command arg1 arg2"), you can write hc.command(arg1, arg2). If
arguments are not strings they will be converted (with tostring) prior
to os.execute invocation. I added an explicit conversion (function
"signed", feel free to use a shorter name like "S") for signed numbers
that had a plus (+) sign in your original code.
Attachment:
herbstluftwm2.lua
Description: Binary data