
    static int l_get2dMap(lua_State *L)
	{
		// Get the table insert function
		lua_getglobal(L, "table");
		lua_getfield(L, -1, "insert");
		int table_insert = lua_gettop(L);
		
		LuaPerlinNoiseMap *o = checkobject(L, 1);
		v2f p = read_v2f(L, 2);
		
		Noise &n = o->noise;
		n.perlinMap2D(p.X, p.Y);
		int i = 0;
		for (int y = 0; y != n.sy; y++) {
			lua_pushvalue(L, table_insert);
			lua_pushvalue(L, table);
			for (int x = 0; x != n.xy; x++) {
				lua_pushvalue(L, table_insert);
				lua_pushvalue(L, table);
				lua_pushnumber(L, n.result[i++]);
			}
		}
		return 1;
	}
