Comparison

util-src/windows.c @ 6789:6b180e77c97a

util-src/*.c: Invert Lua 5.2 compat to be 5.2+ by default and a macro to support 5.1
author Kim Alvefur <zash@zash.se>
date Sun, 26 Apr 2015 12:38:37 +0200
parent 6615:8e4572a642cb
child 7818:54669df178c2
comparison
equal deleted inserted replaced
6788:d64c1f3c7e2e 6789:6b180e77c97a
17 #include <windns.h> 17 #include <windns.h>
18 18
19 #include "lua.h" 19 #include "lua.h"
20 #include "lauxlib.h" 20 #include "lauxlib.h"
21 21
22 #if (LUA_VERSION_NUM == 502) 22 #if (LUA_VERSION_NUM == 501)
23 #define luaL_register(L, N, R) luaL_setfuncs(L, R, 0) 23 #define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
24 #endif 24 #endif
25 25
26 static int Lget_nameservers(lua_State* L) { 26 static int Lget_nameservers(lua_State* L) {
27 char stack_buffer[1024]; // stack allocated buffer 27 char stack_buffer[1024]; // stack allocated buffer
28 IP4_ARRAY* ips = (IP4_ARRAY*) stack_buffer; 28 IP4_ARRAY* ips = (IP4_ARRAY*) stack_buffer;
102 { NULL, NULL } 102 { NULL, NULL }
103 }; 103 };
104 104
105 LUALIB_API int luaopen_util_windows(lua_State* L) { 105 LUALIB_API int luaopen_util_windows(lua_State* L) {
106 lua_newtable(L); 106 lua_newtable(L);
107 luaL_register(L, NULL, Reg); 107 luaL_setfuncs(L, Reg, 0);
108 lua_pushliteral(L, "-3.14"); 108 lua_pushliteral(L, "-3.14");
109 lua_setfield(L, -2, "version"); 109 lua_setfield(L, -2, "version");
110 return 1; 110 return 1;
111 } 111 }