Skip to content

Word30210/luau-confusables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

luau-confusable

luau-confusable is a confusable character checker I ported from luau-lang/luau/Ast/src/Confusables.cpp.

Example

const confusables = require("@path/to/luau_confusable")

const input = "𝐖or𝑑"
local corrected_input = ""

for _, codepoint in utf8.codes(input) do
    local confusable = confusables(codepoint)

    if confusable then
        print(`Unicode character U+{ string.format("%X", codepoint) } (did you mean '{ confusable }'?)`)

        corrected_input ..= confusable
    else
        corrected_input ..= utf8.char(codepoint)
    end
end

print(`Hello, { corrected_input }!`) -- Hello, Word!

About

a confusable character checker for Luau

Topics

Resources

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE
MIT
lua_LICENSE.txt
MIT
luau_LICENSE.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages