summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.h
diff options
context:
space:
mode:
authorTycho Bickerstaff <work.tycho@gmail.com>2013-12-22 16:21:34 +0100
committerTycho Bickerstaff <work.tycho@gmail.com>2013-12-22 16:21:34 +0100
commit1a9d93665f9f82ccd9054aa1c8e9c24f13776a91 (patch)
treee9572b3fdf1d47c0769a3d43d3fc4dfac68fd0dd /src/Bindings/LuaState.h
parentbasic threadsafe queue interface (diff)
parentUpdate GETTING-STARTED.md (diff)
downloadcuberite-1a9d93665f9f82ccd9054aa1c8e9c24f13776a91.tar
cuberite-1a9d93665f9f82ccd9054aa1c8e9c24f13776a91.tar.gz
cuberite-1a9d93665f9f82ccd9054aa1c8e9c24f13776a91.tar.bz2
cuberite-1a9d93665f9f82ccd9054aa1c8e9c24f13776a91.tar.lz
cuberite-1a9d93665f9f82ccd9054aa1c8e9c24f13776a91.tar.xz
cuberite-1a9d93665f9f82ccd9054aa1c8e9c24f13776a91.tar.zst
cuberite-1a9d93665f9f82ccd9054aa1c8e9c24f13776a91.zip
Diffstat (limited to 'src/Bindings/LuaState.h')
-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