Permalink
Browse files

Fixes for examples. Wrapped keywords into guardian in keyword_rename …

…test
  • Loading branch information...
1 parent 7e09b66 commit ce2760f77e9ab04ce276244ee4329aeba7ddea54 @v-for-vandal committed Nov 11, 2013
@@ -36,6 +36,10 @@ extern "C" int luaopen_example2(lua_State*L);
#define DEBUG2(X,Y) {printf(X,Y);fflush(stdout);}
#define DEBUG3(X,Y,Z) {printf(X,Y,Z);fflush(stdout);}
+#if LUA_VERSION_NUM > 501
+#define lua_open luaL_newstate
+#endif
+
void testModule(lua_State *L)
{
swig_type_info *pTypeInfo=0,*pTypeInfo2=0;
@@ -4,6 +4,7 @@ TARGET = embed
SRCS = example.c
INTERFACE = example.i
LUA_INTERP = embed.c
+LIBS = -lm
# this is a little different to normal as we have our own special interpreter
# which we want to static link
@@ -12,7 +13,7 @@ check: build
build:
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' LIBS='$(LIBS)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static
clean:
$(MAKE) -f $(TOP)/Makefile lua_clean
@@ -18,6 +18,10 @@ We will be using the luaL_dostring()/lua_dostring() function to call into lua
#include <lauxlib.h>
#include <lualib.h>
+#if LUA_VERSION_NUM > 501
+#define lua_open luaL_newstate
+#endif
+
/* the SWIG wrappered library */
extern int luaopen_example(lua_State*L);
@@ -4,6 +4,7 @@ TARGET = embed2
SRCS = example.c
INTERFACE = example.i
LUA_INTERP = embed2.c
+LIBS = -lm
# this is a little different to normal as we have our own special interpreter
# which we want to static link
@@ -12,7 +13,7 @@ check: build
build:
$(MAKE) -f $(TOP)/Makefile $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' LIBS='$(LIBS)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static
clean:
$(MAKE) -f $(TOP)/Makefile lua_clean
@@ -32,8 +32,10 @@ KW(go, defer)
KW(chan, fallthrough)
/* Lua keywords */
+#ifdef SWIGLUA
KW(end, function)
KW(nil,local)
+#endif
%}
View
@@ -357,6 +357,9 @@ SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L)
lua_pop(L,1); /* remove the value */
}
lua_pop(L,1); /* remove the value .set table */
+ lua_pop(L,1); /* remote metatable */
+ assert(lua_gettop(L) == 3); // TODO: REMOVE
+ lua_rawset(L,-3);
return 0;
}
@@ -505,7 +508,7 @@ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname);
typedef int (*swig_lua_base_iterator_func)(lua_State*,swig_type_info*, int, int *ret);
-int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info *swig_type, int first_arg, swig_lua_base_iterator_func func, int *const ret)
+SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info *swig_type, int first_arg, swig_lua_base_iterator_func func, int *const ret)
{
// first_arg - position of the object in stack. Everything that is above are arguments
// and is passed to every evocation of the func

0 comments on commit ce2760f

Please sign in to comment.