From cc6a8f553e703ca305454f612256fb734861ad0f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 15 Feb 2015 13:03:49 +0100 Subject: ScriptContext pushArgs cleanup --- src/control/ScriptContext.hpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/control/ScriptContext.hpp b/src/control/ScriptContext.hpp index 13279ec..191be92 100644 --- a/src/control/ScriptContext.hpp +++ b/src/control/ScriptContext.hpp @@ -36,6 +36,7 @@ extern "C" { #include #include +#include #include @@ -54,37 +55,36 @@ private: void load(const std::string &script); - size_t pushArgs() { - return 0; - } - template - size_t pushArgs(std::nullptr_t __attribute__((unused)) v, Args ...args) { + void pushArg(std::nullptr_t __attribute__((unused)) v) { lua_pushnil(L); - return pushArgs(args...) + 1; } - template - size_t pushArgs(const std::string &v, Args ...args) { + void pushArg(const std::string &v) { lua_pushstring(L, v.c_str()); - return pushArgs(args...) + 1; } - template - size_t pushArgs(T v, Args ...args) { + template::value>::type> + void pushArg(T v) { lua_pushnumber(L, v); - return pushArgs(args...) + 1; } - template - size_t pushArgs(bool v, Args ...args) { + void pushArg(bool v) { lua_pushboolean(L, v); - return pushArgs(args...) + 1; } - template - size_t pushArgs(Model::ScriptValue &v, Args ...args) { + void pushArg(Model::ScriptValue &v) { v.push(L); + } + + + size_t pushArgs() { + return 0; + } + + template + size_t pushArgs(T v, Args ...args) { + pushArg(v); return pushArgs(args...) + 1; } -- cgit v1.2.3