Software /
code /
prosody
Comparison
util-src/encodings.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 | 6643:127b9f0c6135 |
child | 7818:54669df178c2 |
comparison
equal
deleted
inserted
replaced
6788:d64c1f3c7e2e | 6789:6b180e77c97a |
---|---|
19 #include <string.h> | 19 #include <string.h> |
20 #include <stdlib.h> | 20 #include <stdlib.h> |
21 #include "lua.h" | 21 #include "lua.h" |
22 #include "lauxlib.h" | 22 #include "lauxlib.h" |
23 | 23 |
24 #if (LUA_VERSION_NUM == 502) | 24 #if (LUA_VERSION_NUM == 501) |
25 #define luaL_register(L, N, R) luaL_setfuncs(L, R, 0) | 25 #define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R) |
26 #endif | 26 #endif |
27 | 27 |
28 /***************** BASE64 *****************/ | 28 /***************** BASE64 *****************/ |
29 | 29 |
30 static const char code[] = | 30 static const char code[] = |
528 init_icu(); | 528 init_icu(); |
529 #endif | 529 #endif |
530 lua_newtable(L); | 530 lua_newtable(L); |
531 | 531 |
532 lua_newtable(L); | 532 lua_newtable(L); |
533 luaL_register(L, NULL, Reg_base64); | 533 luaL_setfuncs(L, Reg_base64, 0); |
534 lua_setfield(L, -2, "base64"); | 534 lua_setfield(L, -2, "base64"); |
535 | 535 |
536 lua_newtable(L); | 536 lua_newtable(L); |
537 luaL_register(L, NULL, Reg_stringprep); | 537 luaL_setfuncs(L, Reg_stringprep, 0); |
538 lua_setfield(L, -2, "stringprep"); | 538 lua_setfield(L, -2, "stringprep"); |
539 | 539 |
540 lua_newtable(L); | 540 lua_newtable(L); |
541 luaL_register(L, NULL, Reg_idna); | 541 luaL_setfuncs(L, Reg_idna, 0); |
542 lua_setfield(L, -2, "idna"); | 542 lua_setfield(L, -2, "idna"); |
543 | 543 |
544 lua_newtable(L); | 544 lua_newtable(L); |
545 luaL_register(L, NULL, Reg_utf8); | 545 luaL_setfuncs(L, Reg_utf8, 0); |
546 lua_setfield(L, -2, "utf8"); | 546 lua_setfield(L, -2, "utf8"); |
547 | 547 |
548 lua_pushliteral(L, "-3.14"); | 548 lua_pushliteral(L, "-3.14"); |
549 lua_setfield(L, -2, "version"); | 549 lua_setfield(L, -2, "version"); |
550 return 1; | 550 return 1; |