summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/clua.h
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-21 11:53:18 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-21 11:53:18 +0200
commitb3b5d901b07ae16b3c1397c6e8710239516be68e (patch)
treea7fdf85720e69207292a9b6bbe3285d62edcfbaa /crawl-ref/source/clua.h
parent0b68859a8d428b2af44828c716f80e46450b1b08 (diff)
downloadcrawl-ref-b3b5d901b07ae16b3c1397c6e8710239516be68e.tar.gz
crawl-ref-b3b5d901b07ae16b3c1397c6e8710239516be68e.zip
Move userdata templates to cluautil.h.
Diffstat (limited to 'crawl-ref/source/clua.h')
-rw-r--r--crawl-ref/source/clua.h64
1 files changed, 0 insertions, 64 deletions
diff --git a/crawl-ref/source/clua.h b/crawl-ref/source/clua.h
index daca3922aa..092e551384 100644
--- a/crawl-ref/source/clua.h
+++ b/crawl-ref/source/clua.h
@@ -232,72 +232,8 @@ extern CLua clua;
void lua_set_exclusive_item(const item_def *item = NULL);
-#define LUAWRAP(name, wrapexpr) \
- static int name(lua_State *ls) \
- { \
- wrapexpr; \
- return (0); \
- }
-
-#define PLUARET(type, val) \
- lua_push##type(ls, val); \
- return (1);
-
-#define LUARET1(name, type, val) \
- static int name(lua_State *ls) \
- { \
- lua_push##type(ls, val); \
- return (1); \
- }
-
-#define LUARET2(name, type, val1, val2) \
- static int name(lua_State *ls) \
- { \
- lua_push##type(ls, val1); \
- lua_push##type(ls, val2); \
- return (2); \
- }
-
-#define ASSERT_DLUA \
- do { \
- if (CLua::get_vm(ls).managed_vm) \
- luaL_error(ls, "Operation forbidden in end-user script"); \
- } while (false)
-
-template <class T>
-inline static T *util_get_userdata(lua_State *ls, int ndx)
-{
- return (lua_islightuserdata(ls, ndx))?
- static_cast<T *>( lua_touserdata(ls, ndx) )
- : NULL;
-}
-
-template <class T>
-inline static T *clua_get_userdata(lua_State *ls, const char *mt, int ndx = 1)
-{
- return static_cast<T*>( luaL_checkudata( ls, ndx, mt ) );
-}
-
-template <class T>
-static int lua_object_gc(lua_State *ls)
-{
- T **pptr = static_cast<T**>( lua_touserdata(ls, 1) );
- if (pptr)
- delete *pptr;
- return (0);
-}
-
std::string quote_lua_string(const std::string &s);
-template <class T> T *clua_new_userdata(
- lua_State *ls, const char *mt)
-{
- void *udata = lua_newuserdata( ls, sizeof(T) );
- luaL_getmetatable(ls, mt);
- lua_setmetatable(ls, -2);
- return static_cast<T*>( udata );
-}
-
void print_clua_stack();
#endif