File ibus-pinyin-fixes-lua-compile.patch of Package ibus-pinyin
From c42d0a870697e95301deabe0bcb770a68649c81d Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Wed, 31 Jul 2013 10:53:14 +0800
Subject: [PATCH] fixes lua 5.2 compile
---
lua/lua-plugin-init.c | 8 ++++++++
lua/lua-plugin.c | 9 +++++++++
2 files changed, 17 insertions(+)
--- a/lua/lua-plugin-init.c
+++ b/lua/lua-plugin-init.c
@@ -26,6 +26,17 @@
#include "lua-plugin.h"
+#if LUA_VERSION_NUM >= 502
+/* ugly hack for lua 5.2 */
+
+#define lua_objlen lua_rawlen
+#undef luaL_register
+#define luaL_register(L,n,f) \
+ { if ((n) == NULL) luaL_setfuncs(L,f,0); else luaL_newlib(L,f); }
+
+#endif
+
+
static const luaL_Reg lualibs[] = {
{"", luaopen_base},
{LUA_TABLIBNAME, luaopen_table},
--- a/lua/lua-plugin.c
+++ b/lua/lua-plugin.c
@@ -25,6 +25,15 @@
#include "lua-plugin.h"
+#if LUA_VERSION_NUM >= 502
+/* ugly hack for lua 5.2 */
+
+#define lua_open luaL_newstate
+
+#define lua_objlen lua_rawlen
+
+#endif
+
#define IBUS_ENGINE_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), IBUS_TYPE_ENGINE_PLUGIN, IBusEnginePluginPrivate))
struct _IBusEnginePluginPrivate{
--- a/lua/lmyoslib.c
+++ b/lua/lmyoslib.c
@@ -19,7 +19,15 @@
#include "lauxlib.h"
#include "lualib.h"
+#if LUA_VERSION_NUM >= 502
+/* ugly hack for lua 5.2 */
+#define lua_objlen lua_rawlen
+#undef luaL_register
+#define luaL_register(L,n,f) \
+ { if ((n) == NULL) luaL_setfuncs(L,f,0); else luaL_newlib(L,f); }
+
+#endif
/*
** {======================================================