Cornysz Posted November 8, 2018 Share Posted November 8, 2018 Is it possible to convert error message to string? Example my script have prompt and i input random number and then i got error, and i want after that the script will automatically alert the error. Link to comment Share on other sites More sharing options...
Administrators Enyby Posted November 8, 2018 Administrators Share Posted November 8, 2018 Read data, check contents. If it is not fit you - show alert. You can try use tonumber or regular expression, whatever. Link to comment Share on other sites More sharing options...
Cornysz Posted November 8, 2018 Author Share Posted November 8, 2018 Read data, check contents. If it is not fit you - show alert. You can try use tonumber or regular expression, whatever.What do u mean of Read data, check contents i dont have idea to make dat oof Link to comment Share on other sites More sharing options...
Administrators Enyby Posted November 8, 2018 Administrators Share Posted November 8, 2018 You receive some input from the user. This will be your data. Before you use them, check that there is what you need, and not just random nonsense. Link to comment Share on other sites More sharing options...
CmP Posted November 8, 2018 Share Posted November 8, 2018 4 hours ago, Cornysz said: What do u mean of Read data, check contents i dont have idea to make dat oof local min = 4 local max = 10 local data = gg.prompt({'Input a number between ' .. min .. ' and ' .. max}, {min}, {'number'}) -- read data -- Check contents if data == nil then gg.alert('Dialog was cancelled') os.exit() end local number = tonumber(data[1]) if number == nil then gg.alert('Input was not a valid number') os.exit() end if number < min or number > max then -- if does not fit gg.alert('Input number is not within allowable range') -- show alert os.exit() -- and interrupt script execution (or do whatever is required) end Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.