forked from Sokomine/yl_speak_up
allow to show error messages in input_fs_manage_general
This commit is contained in:
parent
d2f92ced9a
commit
1e7a4a4ad1
@ -94,8 +94,10 @@ yl_speak_up.input_fs_manage_general = function(player, formname, fields,
|
||||
elseif(string.len(fields.add_entry_general:trim()) < min_length) then
|
||||
error_msg = "The name of your new "..what.." is too short.\n"..
|
||||
"It has to be at least "..tostring(min_length).." characters long."
|
||||
elseif(table.indexof(list_of_entries, fields.list_of_entries:trim()) > 0) then
|
||||
error_msg = "A "..what.." with that name exists already."
|
||||
elseif(table.indexof(list_of_entries, fields.add_entry_general:trim()) > 0) then
|
||||
error_msg = "A "..what.." with the name\n \""..
|
||||
minetest.formspec_escape(fields.add_entry_general:trim())..
|
||||
"\"\nexists already."
|
||||
else
|
||||
fields.add_entry_general = fields.add_entry_general:trim()
|
||||
-- this depends on what is created
|
||||
@ -104,9 +106,12 @@ yl_speak_up.input_fs_manage_general = function(player, formname, fields,
|
||||
error_msg = "A new "..what.." named\n \""..
|
||||
minetest.formspec_escape(fields.add_entry_general)..
|
||||
"\"\nhas been created."
|
||||
if(not(res) or res == -1) then
|
||||
if(not(res) or (type(res) == "number" and res == -1)) then
|
||||
error_msg = "Failed to create "..what.." named\n \""..
|
||||
minetest.formspec_escape(fields.add_entry_general).."\"."
|
||||
-- pass on any error messages
|
||||
elseif(type(res) == "string") then
|
||||
error_msg = res
|
||||
else
|
||||
-- select this new entry (add 1 because the first entry of our
|
||||
-- list is adding a new entry)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user