summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-02-15 13:03:49 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-02-15 13:34:42 +0100
commitcc6a8f553e703ca305454f612256fb734861ad0f (patch)
tree80b09f04897d1b8f1d3d4fc4c4a596ca4683a31a /src/control
parentf41fc409959c5c050c3774c654e655589e744e22 (diff)
downloadrpgedit-cc6a8f553e703ca305454f612256fb734861ad0f.tar
rpgedit-cc6a8f553e703ca305454f612256fb734861ad0f.zip
ScriptContext pushArgs cleanup
Diffstat (limited to 'src/control')
-rw-r--r--src/control/ScriptContext.hpp34
1 files changed, 17 insertions, 17 deletions
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 <memory>
#include <string>
+#include <type_traits>
#include <unordered_set>
@@ -54,37 +55,36 @@ private:
void load(const std::string &script);
- size_t pushArgs() {
- return 0;
- }
- template<typename... Args>
- 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<typename... Args>
- 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<typename T, typename... Args>
- size_t pushArgs(T v, Args ...args) {
+ template<typename T, class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
+ void pushArg(T v) {
lua_pushnumber(L, v);
- return pushArgs(args...) + 1;
}
- template<typename... Args>
- size_t pushArgs(bool v, Args ...args) {
+ void pushArg(bool v) {
lua_pushboolean(L, v);
- return pushArgs(args...) + 1;
}
- template<typename... Args>
- size_t pushArgs(Model::ScriptValue &v, Args ...args) {
+ void pushArg(Model::ScriptValue &v) {
v.push(L);
+ }
+
+
+ size_t pushArgs() {
+ return 0;
+ }
+
+ template<typename T, typename... Args>
+ size_t pushArgs(T v, Args ...args) {
+ pushArg(v);
return pushArgs(args...) + 1;
}