Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
#include "location.h"
#include "database.h"
+#include "network.h"
typedef struct database {
struct loc_database* db;
if (r)
return luaL_error(L, "Could not lookup address %s: %s\n", address, strerror(errno));
- // XXX Return the network
-
+ // Create a network object
+ r = create_network(L, network);
loc_network_unref(network);
- return 0;
+ return r;
}
static const struct luaL_Reg database_functions[] = {
return (Network*)userdata;
}
-static int create_network(lua_State* L, struct loc_network* network) {
+int create_network(lua_State* L, struct loc_network* network) {
// Allocate a new object
Network* self = (Network*)lua_newuserdata(L, sizeof(*self));
#include <lua.h>
#include <lauxlib.h>
+#include <libloc/network.h>
+
int register_network(lua_State* L);
+int create_network(lua_State* L, struct loc_network* network);
+
#endif /* LUA_LOCATION_NETWORK_H */