[vlc-commits] lua: merge new functions with the previous table

Ludovic Fauvet git at videolan.org
Wed Mar 16 19:47:40 CET 2016


vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Mar 16 19:44:16 2016 +0100| [398896b9c06248ebff8c8a6a685ae2d71378cbc0] | committer: Ludovic Fauvet

lua: merge new functions with the previous table

All lua plugins are now supposed to work with 5.3

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=398896b9c06248ebff8c8a6a685ae2d71378cbc0
---

 modules/lua/vlc.h |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/lua/vlc.h b/modules/lua/vlc.h
index 4a7a7d3..12980ba 100644
--- a/modules/lua/vlc.h
+++ b/modules/lua/vlc.h
@@ -54,9 +54,14 @@
 # undef luaL_register
 # define luaL_register(L, n, l) luaL_setfuncs(L, (l), 0)
 # define luaL_register_namespace(L, n, l) \
-    lua_newtable( L ); \
+    lua_getglobal( L, n );      \
+    if( lua_isnil( L, -1 ) )    \
+    {                           \
+        lua_pop( L, 1 );        \
+        lua_newtable( L );      \
+    }                           \
     luaL_setfuncs( L, (l), 0 ); \
-    lua_pushvalue( L, -1 ); \
+    lua_pushvalue( L, -1 );     \
     lua_setglobal( L, n );
 #else
 # define luaL_register_namespace(L, n, l) luaL_register( L, n, (l) );



More information about the vlc-commits mailing list