From 5f241445b54fab048fa0f58343bc944cd2818947 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 25 Jul 2011 15:41:32 +0200 Subject: Add readOnlySetField to FbTk::Lua an equivalent of rawsetfield, but for "read only" tables. --- src/FbTk/LuaUtil.cc | 9 +++++++++ src/FbTk/LuaUtil.hh | 1 + 2 files changed, 10 insertions(+) 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) { pop(); } +void Lua::readOnlySetField(int index, const char *k) { + checkstack(1); + index = absindex(index); + + pushstring(k); + insert(-2); + readOnlySet(index); +} + } // 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: * It can be used to modify protected entries or create new ones. */ void readOnlySet(int index); + void readOnlySetField(int index, const char *k); typedef Slot InitFunction; -- cgit v0.11.2