diff --git a/formspec_helpers.lua b/formspec_helpers.lua index 6babbd5..7bf9341 100644 --- a/formspec_helpers.lua +++ b/formspec_helpers.lua @@ -2,14 +2,15 @@ -- helper function: -- create a formspec dropdown list with player names (first entry: Add player) and -- an option to delete players from that list +-- Note: With the what_is_the_list_about-parameter, it is possible to handle i.e. variables as well yl_speak_up.create_dropdown_playerlist = function(player, pname, table_of_names, index_selected, - start_x, start_y, dropdown_name, + start_x, start_y, dropdown_name, what_is_the_list_about, field_name_for_adding_player, explain_add_player, field_name_for_deleting_player, explain_delete_player) local text = "dropdown["..tostring(start_x)..","..tostring(start_y)..";3.8;".. - tostring(dropdown_name)..";Add player:" + tostring(dropdown_name)..";Add "..tostring(what_is_the_list_about)..":" -- table_of_names is a table with the playernames as keys -- we want to work with indices later on; in order to be able to do that reliably, we -- need a defined order of names @@ -27,15 +28,13 @@ yl_speak_up.create_dropdown_playerlist = function(player, pname, text = text.."field["..tostring(start_x + 4.0)..","..tostring(start_y + 0.3)..";3.5,0.9;".. tostring(field_name_for_adding_player)..";;]".. "tooltip["..tostring(field_name_for_adding_player)..";".. - "Enter the name of the player whom you\n".. - "want to grant the right to "..tostring(explain_add_player).."]" + tostring(explain_add_player).."]" else text = text.."button["..tostring(start_x + 3.8)..","..tostring(start_y)..";3.5,0.9;".. tostring(field_name_for_deleting_player)..";".. - "Remove player from list]".. + "Remove "..tostring(what_is_the_list_about).." from list]".. "tooltip["..tostring(field_name_for_deleting_player)..";".. - "If you click here, the player will no\n".. - "longer be able to "..tostring(explain_delete_player).."]" + tostring(explain_delete_player).."]" end return text end