summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;
}