summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-12-29 12:51:58 +0100
committermadmaxoft <github@xoft.cz>2013-12-29 12:51:58 +0100
commit248ba1ea9f6826234535c2a777b3834fbe264e0d (patch)
treeaa52fc2b6d3f78dcaea12d08dd4a2583516d8c8f /src/Bindings/LuaState.h
parentMerge pull request #481 from MikeHunsinger/master (diff)
downloadcuberite-248ba1ea9f6826234535c2a777b3834fbe264e0d.tar
cuberite-248ba1ea9f6826234535c2a777b3834fbe264e0d.tar.gz
cuberite-248ba1ea9f6826234535c2a777b3834fbe264e0d.tar.bz2
cuberite-248ba1ea9f6826234535c2a777b3834fbe264e0d.tar.lz
cuberite-248ba1ea9f6826234535c2a777b3834fbe264e0d.tar.xz
cuberite-248ba1ea9f6826234535c2a777b3834fbe264e0d.tar.zst
cuberite-248ba1ea9f6826234535c2a777b3834fbe264e0d.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/LuaState.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index 15b0cdeff..40bb67e69 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -240,6 +240,25 @@ public:
return CallFunction(0);
}
+ /// Call any 0-param 1-return Lua function in a single line:
+ template<
+ typename FnT, typename RetT1
+ >
+ bool Call(FnT a_FnName, const cRet & a_Mark, RetT1 & a_Ret1)
+ {
+ if (!PushFunction(a_FnName))
+ {
+ return false;
+ }
+ if (!CallFunction(1))
+ {
+ return false;
+ }
+ GetReturn(-1, a_Ret1);
+ lua_pop(m_LuaState, 1);
+ return true;
+ }
+
/// Call any 1-param 1-return Lua function in a single line:
template<
typename FnT, typename ArgT1, typename RetT1