Skip to content

Instantly share code, notes, and snippets.

@oatmealine
Created February 26, 2022 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oatmealine/828651cce1c43bf86d06dd51f6fd6460 to your computer and use it in GitHub Desktop.
Save oatmealine/828651cce1c43bf86d06dd51f6fd6460 to your computer and use it in GitHub Desktop.
Simple, fast Lua uwu-ifier
local uwuify = require 'uwu'
assert(uwuify('really') == 'weawwy')
-- 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