Jump to content




Pig latin translator


  • You cannot reply to this topic
4 replies to this topic

#1 WolfDood

  • Members
  • 20 posts
  • Locationjava.exception:3753:location not found

Posted 13 November 2016 - 05:28 AM

So many of you will probably know what pig latin is right... If you don't click this link: http://bit.ly/2eta44Q

Basically you enter a word and it translates to pig latin, aka igpay atinlay.

Here is the pastebin link: http://pastebin.com/9hRzPF8Y

And here is the code:

Spoiler

I know this is pretty simple but I only just started CC hopefully you will like it.

EDIT: It is currently in BETA so it doesn't convert consonant clusters as in Br or Sw. It also can only convert one word at a time

Edited by WolfDood, 13 November 2016 - 05:35 AM.


#2 WolfDood

  • Members
  • 20 posts
  • Locationjava.exception:3753:location not found

Posted 13 November 2016 - 06:14 AM

I realise I could use concatentation I might implement that into it

#3 Lion4ever

  • Members
  • 91 posts

Posted 14 November 2016 - 12:38 AM

A useful trick in lua:
local vowels = {u=true,
local vowels = {
a=true,
e=true,
i=true,
o=true,
u=true}
if vowels[ string.lower( result[1] ) ] then
--this is a vowel
end

If you use the vowel as a key, you dont need a for loop.

#4 WolfDood

  • Members
  • 20 posts
  • Locationjava.exception:3753:location not found

Posted 14 November 2016 - 01:22 AM

View PostLion4ever, on 14 November 2016 - 12:38 AM, said:

A useful trick in lua:
local vowels = {u=true,
local vowels = {
a=true,
e=true,
i=true,
o=true,
u=true}
if vowels[ string.lower( result[1] ) ] then
--this is a vowel
end

If you use the vowel as a key, you dont need a for loop.

Thanks I will try use that in later versions for now I'm working to make it compatible with consonant clusters

EDIT: Wouldn't you need ""'s around the vowels though

Edited by WolfDood, 14 November 2016 - 01:24 AM.


#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 14 November 2016 - 10:07 AM

View PostWolfDood, on 14 November 2016 - 01:22 AM, said:

EDIT: Wouldn't you need ""'s around the vowels though

That sounds like a "try-it-and-see" sort of question, but the short answer is no - not the way they're being used there.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users