Created
February 26, 2022 15:37
-
-
Save oatmealine/828651cce1c43bf86d06dd51f6fd6460 to your computer and use it in GitHub Desktop.
Simple, fast Lua uwu-ifier
This file contains hidden or 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
local uwuify = require 'uwu' | |
assert(uwuify('really') == 'weawwy') |
This file contains hidden or 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
-- uwu.lua by oatmealine | |
-- disappointed by the lack of a lua uwuifier, i decided to make one | |
-- replace `utf8` with `string` if necessary - or use this polyfill lib https://github.com/Stepets/utf8.lua/ | |
local endings = {'rawr x3', 'OwO', 'UwU', 'o.O', '-.-', '>w<', '(˘ω˘)', 'σωσ', 'ʘwʘ', ':3', 'XD', 'nyaa~~', 'mya', '>_<', 'rawr', '^^', '^^;;', '(^•ω•^)'} | |
return function(str) | |
str = utf8.lower(str) | |
str = utf8.gsub(str, 'small', 'smol') | |
str = utf8.gsub(str, 'cute', 'kawaii~') | |
str = utf8.gsub(str, 'fluff', 'floof') | |
str = utf8.gsub(str, 'love', 'luv') | |
str = utf8.gsub(str, 'stupid', 'baka') | |
str = utf8.gsub(str, 'meow', 'nya~') | |
str = utf8.gsub(str, 'l', 'w') | |
str = utf8.gsub(str, 'r', 'w') | |
str = utf8.gsub(str, 'n([aeiou])', 'ny%1') | |
str = utf8.gsub(str, '[.!?]%s', function(e) return e .. endings[math.random(1, #endings)] .. ' ' end) | |
str = utf8.gsub(str, '(%s)(%a)(%a)', function(space, rep, other) if math.random() < 0.05 then return space .. rep .. '-' .. rep .. other else return space .. rep .. other end end) | |
return str | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment