return r;
}
-static int Country_close(lua_State* L) {
+static int Country_gc(lua_State* L) {
Country* self = luaL_checkcountry(L, 1);
// Free country
return 0;
}
-static int Country_gc(lua_State* L) {
- Country* self = luaL_checkcountry(L, 1);
-
- // Free the object
- free(self);
-
- return 0;
-}
-
static int Country_eq(lua_State* L) {
Country* self = luaL_checkcountry(L, 1);
Country* other = luaL_checkcountry(L, 2);
static const struct luaL_Reg Country_functions[] = {
{ "new", Country_new },
{ "get_code", Country_get_code },
- { "__close", Country_close },
{ "__eq", Country_eq },
{ "__gc", Country_gc },
{ NULL, NULL },
return 1;
}
-static int Database_close(lua_State* L) {
+static int Database_gc(lua_State* L) {
Database* self = luaL_checkdatabase(L, 1);
// Free database
return 0;
}
-static int Database_gc(lua_State* L) {
- Database* self = luaL_checkdatabase(L, 1);
-
- // Free the object
- free(self);
-
- return 0;
-}
-
static int Database_lookup(lua_State* L) {
struct loc_network* network = NULL;
int r;
static const struct luaL_Reg database_functions[] = {
{ "open", Database_open },
{ "lookup", Database_lookup },
- { "__close", Database_close },
{ "__gc", Database_gc },
{ NULL, NULL },
};
return r;
}
-static int Network_close(lua_State* L) {
+static int Network_gc(lua_State* L) {
Network* self = luaL_checknetwork(L, 1);
// Free the network
return 0;
}
-static int Network_gc(lua_State* L) {
- Network* self = luaL_checknetwork(L, 1);
-
- // Free the object
- free(self);
-
- return 0;
-}
-
static int Network_tostring(lua_State* L) {
Network* self = luaL_checknetwork(L, 1);
{ "get_asn", Network_get_asn },
{ "get_family", Network_get_family },
{ "get_country_code", Network_get_country_code },
- { "__close", Network_close },
{ "__gc", Network_gc },
{ "__tostring", Network_tostring },
{ NULL, NULL },