Jump to content

Function - Convert Int to a Roman Number String


Syreldar

Recommended Posts

  • Premium

M2 Download Center

This is the hidden content, please
( Internal )

Hi fellow metin2devs,

 

This is a function i've just written, it will convert any int value to a string representing the given int number in its Roman form, feel free to use it.

 

Example: 9 = IX, 10 = X

 

http://pastebin.com/Cf4ijJnN

  • Metin2 Dev 4
  • Love 7

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

  • Premium

497438f17b.jpg

 

http://pastebin.com/hBp1pRU1

Edited by Metin2 Dev
Core X - External 2 Internal

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium
9 hours ago, luzzo said:

According with lua syntax keep in mind is always better return same time.

What do you mean? Can you be a little more clear about that statement?

9 hours ago, luzzo said:

According with Romans enumeration you have to check the upperbound due to the ascii chars limit

True, thanks.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

3 hours ago, Syreldar said:

What do you mean? Can you be a little more clear about that statement?

True, thanks.

i see you have already corrected it..

I mean before you where returning 0 if n == 0 and that's ok but what i mean is that you should return if is not allowed number something like "" or better nil, so in this case you can check the function in an if statment before printing

like:

local numberconverted = intoroman(somenumber)
if numberconverted then

 print(numberconverted)

else

 print("i can't convert this number")

Link to comment
Share on other sites

  • Premium
1 minute ago, luzzo said:

i see you have already corrected it..

I mean before you where returning 0 if n == 0 and that's ok but what i mean is that you should return if is not allowed number something like "" or better nil, so in this case you can check the function in an if statment before printing

like:

local numberconverted = intoroman(somenumber)
if numberconverted then

 print(numberconverted)

else

 print("i can't convert this number")

OH! Thanks a lot!

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium
1 hour ago, Exygo said:

Awesome!

Thanks but it's really just something which popped up in my head while i was on drugs, nothing special really!

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

Announcements



  • Similar Content

  • Activity

    1. 3

      Crystal Metinstone

    2. 3

      Feeding game source to LLM

    3. 113

      Ulthar SF V2 (TMP4 Base)

    4. 3

      Feeding game source to LLM

    5. 0

      Target Information System

    6. 3

      Feeding game source to LLM

    7. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.