mirror of
https://github.com/lunarmodules/lua-iconv.git
synced 2025-09-05 02:32:19 +02:00
Make the library comptible with both Lua 5.1 and Lua 5.2
This commit is contained in:
12
luaiconv.c
12
luaiconv.c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* luaiconv - Performs character set conversions in Lua
|
||||
* (c) 2005-10 Alexandre Erwin Ittner <alexandre@ittner.com.br>
|
||||
* (c) 2005-11 Alexandre Erwin Ittner <alexandre@ittner.com.br>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -39,6 +39,16 @@
|
||||
#define LIB_VERSION LIB_NAME " 7"
|
||||
#define ICONV_TYPENAME "iconv_t"
|
||||
|
||||
#if LUA_VERSION_NUM < 501
|
||||
#error "Unsuported Lua version. You must use Lua >= 5.1"
|
||||
#endif
|
||||
|
||||
#if LUA_VERSION_NUM < 502
|
||||
#define luaL_newlib(L, f) { lua_newtable(L); luaL_register(L, NULL, f); }
|
||||
#define lua_rawlen(L, i) lua_objlen(L, i)
|
||||
#endif
|
||||
|
||||
|
||||
#define BOXPTR(L, p) (*(void**)(lua_newuserdata(L, sizeof(void*))) = (p))
|
||||
#define UNBOXPTR(L, i) (*(void**)(lua_touserdata(L, i)))
|
||||
|
||||
|
Reference in New Issue
Block a user