Skip to content

Commit

Permalink
Merge branch 'lua-5.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
pakozm committed Aug 26, 2013
2 parents 60616e0 + ef93e90 commit 721ca1a
Show file tree
Hide file tree
Showing 177 changed files with 22,272 additions and 18,603 deletions.
22 changes: 15 additions & 7 deletions binding/bind_templates/luabind_template.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ extern "C" {
function lua_setdottedname(dottedname)
local cpp_str = {
"\nbool exists = false;\n",
"lua_pushvalue(L,LUA_GLOBALSINDEX);\n"
"lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);\n"
}
for subName in string.gfind(dottedname, "([%w_]+)[%.]*") do
for subName in string.gmatch(dottedname, "([%w_]+)[%.]*") do
table.insert(cpp_str, string.format([[
// stack: tablevieja
lua_pushstring(L,"%s");
Expand Down Expand Up @@ -184,11 +184,19 @@ int lua_new_$$ClassName$$_$$FILENAME2$$(lua_State *L) {

int lua_delete_$$ClassName$$_$$FILENAME2$$(lua_State *L){
$$ClassName$$ *obj = lua_rawget$$ClassName$$_$$FILENAME2$$(L,1);
DEBUG_OBJ("lua_delete_$$ClassName$$ (begin)",obj);
$$class.destructor$$
if (obj != 0) {
DEBUG_OBJ("lua_delete_$$ClassName$$ (begin)",obj);
$$class.destructor$$
DEBUG_OBJ("lua_delete_$$ClassName$$ (end)",obj);
// Hacemos un DecRef para borrar la referencia a este objeto
DecRef(obj);
// Hacemos un DecRef para borrar la referencia a este objeto
DecRef(obj);
}
// FIXME: This warning is due to the META_INSTANCE table, which is a metatable
// of itself and has a __gc method, so at the end of APRIL execution, the __gc
// is executed with a NULL pointer
else {
DEBUG_OBJ("lua_delete_$$ClassName$$ WARNING!! NULL pointer", obj);
}
return 0;
}

Expand Down Expand Up @@ -303,7 +311,7 @@ void luaopen_$$ClassName$$_$$FILENAME2$$(lua_State *L){
/* Esto no hace falta
lua_pushstring(L,"$$(LUANAME[ClassName] or ClassName)$$");
lua_pushvalue(L,class_table);
lua_rawset(L,LUA_GLOBALSINDEX);
lua_rawset(L,LUA_RIDX_GLOBALS);
*/

lua_pop(L,1); // luabind_classes
Expand Down
5 changes: 4 additions & 1 deletion binding/c_src/luabindutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ int equaluserdata(lua_State *L);

typedef char* NEW_STRING;


#define lua_strlen(L,idx) luaL_len((L),(idx))

bool lua_tobool(lua_State *L, int idx);
int lua_toint(lua_State *L, int idx);
int64_t lua_toint64(lua_State *L, int idx);
Expand Down Expand Up @@ -56,7 +59,7 @@ void check_table_fields(lua_State *L, int idx, ...);

#define LUABIND_TABLE_GETN(idx, var) \
do { \
var = (int)lua_objlen(L,idx); \
var = (int)luaL_len(L,idx); \
} while (0)

#define LUABIND_TABLE_TO_VECTOR(table, tipo, vector, longitud) \
Expand Down
14 changes: 0 additions & 14 deletions binding/c_src/utilLua.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@ bool leer_bool_params(lua_State *L, const char *name, bool *v, int n) {
return true;
}

// toma una tabla en la pila y devuelve la longitud de la misma
// la pila se queda igual, con la tabla en el tope
int table_getn(lua_State *L) {
lua_pushstring(L,"table");
lua_gettable(L, LUA_GLOBALSINDEX);
lua_pushstring(L,"getn");
lua_gettable(L, -2);
lua_pushvalue(L,-3);
lua_call(L,1,1);
int l = (int)lua_tonumber(L,-1);
lua_pop(L,2);
return l;
}

int table_to_char_vector(lua_State *L, char ***vec) {
int length = table_getn(L);
char **v = new char*[length];
Expand Down
2 changes: 1 addition & 1 deletion binding/c_src/utilLua.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bool leer_bool_params(lua_State *L, const char *name, bool *v, int n);

// toma una tabla en la pila y devuelve la longitud de la misma
// la pila se queda igual, con la tabla en el tope
int table_getn(lua_State *L);
#define table_getn(L) luaL_len((L),-1);

// cargan una tabla que contiene valores de tipo int, float o double
// devuelve el tamaño del vector reservado usando new tipo[...] que
Expand Down
Loading

0 comments on commit 721ca1a

Please sign in to comment.