From d91899b389c42e6ce422dcdb3b45963e68be8bc5 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 700ef1a..01744bf 100644 --- a/src/FbTk/LuaUtil.cc +++ b/src/FbTk/LuaUtil.cc @@ -115,4 +115,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 d013ed9..0b33040 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); template static void registerInitFunction(const Functor &fn) { -- cgit v0.11.2