5 #include "event_buffer.h" |
5 #include "event_buffer.h" |
6 #include "buffer_event.h" |
6 #include "buffer_event.h" |
7 |
7 |
8 #include <lauxlib.h> |
8 #include <lauxlib.h> |
9 #include <assert.h> |
9 #include <assert.h> |
|
10 #include <string.h> |
10 |
11 |
11 #define EVENT_BASE_MT "EVENT_BASE_MT" |
12 #define EVENT_BASE_MT "EVENT_BASE_MT" |
12 |
13 |
13 le_base* event_base_get(lua_State* L, int idx) { |
14 le_base* event_base_get(lua_State* L, int idx) { |
14 return (le_base*)luaL_checkudata(L, idx, EVENT_BASE_MT); |
15 return (le_base*)luaL_checkudata(L, idx, EVENT_BASE_MT); |
103 lua_pushinteger(L, ret); |
104 lua_pushinteger(L, ret); |
104 return 1; |
105 return 1; |
105 } |
106 } |
106 |
107 |
107 static int luaevent_method(lua_State* L) { |
108 static int luaevent_method(lua_State* L) { |
|
109 #ifdef _EVENT_VERSION |
108 le_base *base = event_base_get(L, 1); |
110 le_base *base = event_base_get(L, 1); |
109 lua_pushstring(L, event_base_get_method(base->base)); |
111 if(strcmp(_EVENT_VERSION, "1.3")<0) |
|
112 lua_pushstring(L, event_base_get_method(base->base)); |
|
113 else |
|
114 #endif |
|
115 lua_pushstring(L, event_get_method()); |
110 return 1; |
116 return 1; |
111 } |
117 } |
112 |
118 |
113 static luaL_Reg base_funcs[] = { |
119 static luaL_Reg base_funcs[] = { |
114 { "addevent", luaevent_addevent }, |
120 { "addevent", luaevent_addevent }, |