On Thu, Dec 13, 2012 at 08:44:40PM +0100, Hilko Bengen wrote:
---
generator/lua.ml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/generator/lua.ml b/generator/lua.ml
index 7461cbd..3626ce8 100644
--- a/generator/lua.ml
+++ b/generator/lua.ml
@@ -48,6 +48,10 @@ let generate_lua_c () =
#include <lua.h>
#include <lauxlib.h>
+#if LUA_VERSION_NUM >= 502
+#define lua_objlen lua_rawlen
+#endif
+
#include <guestfs.h>
#define GUESTFS_LUA_HANDLE \"guestfs handle\"
@@ -904,11 +908,19 @@ luaopen_guestfs (lua_State *L)
/* Create metatable. */
luaL_newmetatable (L, GUESTFS_LUA_HANDLE);
+#if LUA_VERSION_NUM >= 502
+ luaL_setfuncs (L, metamethods, 0);
+#else
luaL_register (L, NULL, metamethods);
+#endif
/* Create methods table. */
lua_newtable (L);
+#if LUA_VERSION_NUM >= 502
+ luaL_setfuncs (L, methods, 0);
+#else
luaL_register (L, NULL, methods);
+#endif
/* Set __index field of metatable to point to methods table. */
lua_setfield (L, -2, \"__index\");
@@ -918,7 +930,11 @@ luaopen_guestfs (lua_State *L)
/* Create module functions table. */
lua_newtable (L);
+#if LUA_VERSION_NUM >= 502
+ luaL_setfuncs (L, functions, 0);
+#else
luaL_register (L, NULL, functions);
+#endif
/* Globals in the module namespace. */
lua_pushliteral (L, \"event_all\");
--
ACK, as far as I can tell.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/