]>
jfr.im git - irc/quakenet/newserv.git/blob - lua/lua.h
1 /* Copyright (C) Chris Porter 2005 */
2 /* ALL RIGHTS RESERVED. */
3 /* Don't put this into the SVN repo. */
13 #include "../lib/sstring.h"
15 #define LUA_BOTVERSION "1.37"
16 #define LUA_CHANFIXBOT "Z"
17 #define LUA_OPERCHAN "#twilightzone"
18 #define LUA_PUKECHAN "#qnet.keepout"
20 #define LUA_DEBUGSOCKET
28 #define LUA_DEBUGSOCKET_ADDRESS "127.0.0.1"
29 #define LUA_DEBUGSOCKET_PORT 7733
31 typedef struct lua_list
{
35 struct lua_list
*next
;
36 struct lua_list
*prev
;
39 #define LUA_STARTLOOP(l) { lua_list *ll; for(ll=lua_head;ll;ll=ll->next) { l = ll->l
41 #define LUA_ENDLOOP() } }
43 #define LUA_PATHLEN 1024
45 extern lua_list
*lua_head
;
46 extern sstring
*cpath
;
48 lua_State
*lua_loadscript(char *file
);
49 void lua_unloadscript(lua_list
*l
);
50 lua_list
*lua_scriptloaded(char *name
);
51 lua_list
*lua_listfromstate(lua_State
*l
);
53 #define lua_toint(l, n) (int)lua_tonumber(l, n)
54 #define lua_isint(l, n) lua_isnumber(l, n)
55 #define lua_pushint(l, n) lua_pushnumber(l, n)
57 #define lua_tolong(l, n) (long)lua_tonumber(l, n)
58 #define lua_islong(l, n) lua_isnumber(l, n)
59 #define lua_pushlong(l, n) lua_pushnumber(l, n)
61 #ifdef LUA_DEBUGSOCKET
63 void lua_debugoutput(char *p
, ...);
64 #define DEBUGOUT(p, ...) lua_debugoutput(p , ##__VA_ARGS__)
65 #define lua_debugpcall(l, message, ...) { lua_list *l2 = lua_listfromstate(l); DEBUGOUT("%s: %s\n", l2->name->content, message); l2->calls++; lua_pcall(l , ##__VA_ARGS__); }
69 #define DEBUGOUT(p, ...)
70 #define lua_debugpcall(l, message, ...) { lua_listfromstate(l)->calls++; lua_pcall(l , ##__VA_ARGS__); }
77 #define INLINE __attribute((always_inline)) inline
81 #define INLINE __forceinline