Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dict = {
- a = "あ",
- i = "い",
- u = "う",
- e = "え",
- o = "お"
- }
- local function roman_to_japanese(text)
- local converted = ""
- while text ~= "" do
- local ok = false
- for i = 1, 3 do
- local subbed = text:sub(1, i)
- if dict[subbed] then
- converted = converted..dict[subbed]
- text = text:sub(i + 1, -1)
- ok = true
- break
- end
- end
- if not ok then
- error("no!")
- end
- end
- return converted
- end
- print(roman_to_japanese("aiueoaieueo"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement