Created
August 29, 2022 22:54
-
-
Save tonetheman/98685968d020c673b6e8c58f6cc99bee to your computer and use it in GitHub Desktop.
lua code for a mod that works for 1 based numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
saw this buried in this code | |
https://www.lexaloffle.com/bbs/?tid=49068 | |
]]-- | |
function mod(val,modulo) | |
--Mod for 1 based numbers. | |
--3%3=3. 4%3=1, 1%3=1 | |
return (val-1)%modulo+1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment