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

Remove unused line from wireless.lua #555

Merged
merged 1 commit into from Aug 15, 2019

Conversation

@ilario
Copy link
Member

commented Aug 2, 2019

In wireless.lua from lime-system package the third line here can be safely removed:

if type(channel) == "table" then
	local chanIndex = 1 + radioName:match("%d+$") % #channel
	chanIndex = chanIndex > 0 and chanIndex or 1
	channel = channel[chanIndex]
end

In Lua the % operator (in the second line) has always zero or positive output and has the precedence over the + operator.
So chanIndex calculated in the second line will always be at least 1 and there is no need for the third line.

I cannot test as I don't own any router with more than one radio on the same band...

@ilario ilario referenced this pull request Aug 6, 2019
@G10h4ck
G10h4ck approved these changes Aug 7, 2019

@spiccinini spiccinini self-requested a review Aug 15, 2019

@ilario ilario merged commit a2e0534 into libremesh:master Aug 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.