summaryrefslogtreecommitdiff
path: root/src/scripting/luautil.h
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2012-07-22 12:50:51 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2012-07-22 12:50:51 +0200
commit9e00e7517202d15d97f1bcccf230528b4f484ad8 (patch)
treeb7413f56a5771f6a3641b54d43ad3cfe035899fc /src/scripting/luautil.h
parent538b81540c7e04c5b1793d50aaf9ac8958878524 (diff)
parent4f6f59bfb33bb5814b5489a405074c900b5299ab (diff)
downloadmanaserv-9e00e7517202d15d97f1bcccf230528b4f484ad8.tar.gz
manaserv-9e00e7517202d15d97f1bcccf230528b4f484ad8.tar.bz2
manaserv-9e00e7517202d15d97f1bcccf230528b4f484ad8.tar.xz
manaserv-9e00e7517202d15d97f1bcccf230528b4f484ad8.zip
Merge remote-tracking branch 'origin/master' into lpc2012
Diffstat (limited to 'src/scripting/luautil.h')
-rw-r--r--src/scripting/luautil.h39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h
index e2ee5737..1ff2ab8d 100644
--- a/src/scripting/luautil.h
+++ b/src/scripting/luautil.h
@@ -48,9 +48,6 @@ class MonsterClass;
class NPC;
class StatusEffect;
-// Report script errors and interrupt the script.
-void raiseScriptError(lua_State *s, const char *format, ...);
-
void raiseWarning(lua_State *s, const char *format, ...);
/**
@@ -183,10 +180,26 @@ Script::Thread* checkCurrentThread(lua_State *s, Script *script = 0);
/* Polymorphic wrapper for pushing variables.
Useful for templates.*/
-void push(lua_State *s, int val);
-void push(lua_State *s, const std::string &val);
-void push(lua_State *s, Entity *val);
-void push(lua_State *s, double val);
+
+inline void push(lua_State *s, int val)
+{
+ lua_pushinteger(s, val);
+}
+
+inline void push(lua_State *s, const std::string &val)
+{
+ lua_pushstring(s, val.c_str());
+}
+
+inline void push(lua_State *s, Entity *val)
+{
+ lua_pushlightuserdata(s, val);
+}
+
+inline void push(lua_State *s, double val)
+{
+ lua_pushnumber(s, val);
+}
inline void push(lua_State *s, AttackInfo *val)
{
@@ -200,7 +213,8 @@ inline void push(lua_State *s, MapObject *val)
/* Pushes an STL LIST */
-template <typename T> void pushSTLContainer(lua_State *s, const std::list<T> &container)
+template <typename T>
+void pushSTLContainer(lua_State *s, const std::list<T> &container)
{
int len = container.size();
lua_createtable(s, len, 0);
@@ -217,7 +231,8 @@ template <typename T> void pushSTLContainer(lua_State *s, const std::list<T> &co
}
/* Pushes an STL VECTOR */
-template <typename T> void pushSTLContainer(lua_State *s, const std::vector<T> &container)
+template <typename T>
+void pushSTLContainer(lua_State *s, const std::vector<T> &container)
{
int len = container.size();
lua_createtable(s, len, 0);
@@ -231,7 +246,8 @@ template <typename T> void pushSTLContainer(lua_State *s, const std::vector<T> &
}
/* Pushes an STL MAP */
-template <typename Tkey, typename Tval> void pushSTLContainer(lua_State *s, const std::map<Tkey, Tval> &container)
+template <typename Tkey, typename Tval>
+void pushSTLContainer(lua_State *s, const std::map<Tkey, Tval> &container)
{
int len = container.size();
lua_createtable(s, 0, len);
@@ -249,7 +265,8 @@ template <typename Tkey, typename Tval> void pushSTLContainer(lua_State *s, cons
}
/* Pushes an STL SET */
-template <typename T> void pushSTLContainer(lua_State *s, const std::set<T> &container)
+template <typename T>
+void pushSTLContainer(lua_State *s, const std::set<T> &container)
{
int len = container.size();
lua_createtable(s, len, 0);