A Luau (Roblox) module for converting numbers between decimal, binary, and hexadecimal formats.
- Convert Decimal to Binary
- Convert Binary to Decimal
- Convert Decimal to Hexadecimal
- Convert Hexadecimal to Decimal
All conversions are done manually without relying solely on built-in functions, making it a great learning tool!
Simply copy the BaseConverters.lua file into your Roblox project or require it from your preferred location.
local BaseConverters = require(path.to.BaseConverters)
-- Decimal to Binary
print(BaseConverters.DecimalToBinary(10)) -- Output: "1010"
-- Binary to Decimal
print(BaseConverters.BinaryToDecimal("1010")) -- Output: 10
-- Decimal to Hexadecimal
print(BaseConverters.DecimalToHexadecimal(255)) -- Output: "FF"
-- Hexadecimal to Decimal
print(BaseConverters.HexadecimalToDecimal("FF")) -- Output: 255BlocksumoGuys