aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-25 13:41:32 (GMT)
committerPavel Labath <pavelo@centrum.sk>2013-02-18 21:04:24 (GMT)
commit5f241445b54fab048fa0f58343bc944cd2818947 (patch)
tree8541f90384c51f6539a325bd41f67d6c590cfcde
parent8e408fb12177586d09bc42536bbf54db54fa605d (diff)
downloadfluxbox_pavel-5f241445b54fab048fa0f58343bc944cd2818947.zip
fluxbox_pavel-5f241445b54fab048fa0f58343bc944cd2818947.tar.bz2
Add readOnlySetField to FbTk::Lua
an equivalent of rawsetfield, but for "read only" tables.
-rw-r--r--src/FbTk/LuaUtil.cc9
-rw-r--r--src/FbTk/LuaUtil.hh1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/FbTk/LuaUtil.cc b/src/FbTk/LuaUtil.cc
index 8f382e8..a5413f2 100644
--- a/src/FbTk/LuaUtil.cc
+++ b/src/FbTk/LuaUtil.cc
@@ -132,4 +132,13 @@ void Lua::readOnlySet(int index) {
132 pop(); 132 pop();
133} 133}
134 134
135void Lua::readOnlySetField(int index, const char *k) {
136 checkstack(1);
137 index = absindex(index);
138
139 pushstring(k);
140 insert(-2);
141 readOnlySet(index);
142}
143
135} // namespace FbTk 144} // namespace FbTk
diff --git a/src/FbTk/LuaUtil.hh b/src/FbTk/LuaUtil.hh
index 12a687e..2c611ac 100644
--- a/src/FbTk/LuaUtil.hh
+++ b/src/FbTk/LuaUtil.hh
@@ -52,6 +52,7 @@ public:
52 * It can be used to modify protected entries or create new ones. 52 * It can be used to modify protected entries or create new ones.
53 */ 53 */
54 void readOnlySet(int index); 54 void readOnlySet(int index);
55 void readOnlySetField(int index, const char *k);
55 56
56 typedef Slot<void, Lua &> InitFunction; 57 typedef Slot<void, Lua &> InitFunction;
57 58