Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate user inputs #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

a-tour-ist
Copy link
Contributor

@@ -76,7 +77,7 @@ local object_detector_digiline = {
make_formspec(meta)
end
end
if msg.scanname then
if msg.scanname and type(msg.scanname) == "string" then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is equivalent:

Suggested change
if msg.scanname and type(msg.scanname) == "string" then
if type(msg.scanname) == "string" then

@@ -36,7 +36,8 @@ local object_detector_scan = function (pos)
local scanname = meta:get_string("scanname")
local scan_all = scanname == ""
local scan_names = scanname:split(',')
local radius = meta:get_int("radius")
local max_radius = moremesecons.setting("adjustable_player_detector", "max_radius", 16, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this outside the function. That way moremesecons.setting will check the validity of the setting on startup, and only log a warning once (if it happens to be invalid).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants