-- Generates formspec data for the map marker editor -- selected_id: The id of the currently selected marker, or nil if no marker is -- selected -- detail: The map's detail level -- -- Returns a formspec string for use in containers function _cartographer.generate_marker_formspec(selected_id, detail) local fs = "button[0,0;0.5,0.5;clear_marker;x]"; if selected_id then fs = fs .. string.format("style[marker-%s;bgcolor=blue]", selected_id); end -- TODO: Support pagination if _cartographer.marker_count is too high local i = 0; for id in pairs(_cartographer.marker_lookup) do fs = fs .. string.format("image_button[%f,%f;0.5,0.5;%s.png;marker-%s;]", i % 5 * 0.5, math.floor(i / 5) * 0.5 + 0.5, cartographer.get_marker_texture(id, detail), id); i = i + 1; end return fs; end