Jump to content
×
×
  • Create New...

Function - Convert Int to a Roman Number String


Syreldar

Recommended Posts

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( 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 1
  • Love 5

👑 Premium International Lua Developer 👑

 My service topic: https://bit.ly/2UPly54

 

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

Link to comment
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.

👑 Premium International Lua Developer 👑

 My service topic: https://bit.ly/2UPly54

 

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

Link to comment
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
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!

👑 Premium International Lua Developer 👑

 My service topic: https://bit.ly/2UPly54

 

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

Link to comment
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!

👑 Premium International Lua Developer 👑

 My service topic: https://bit.ly/2UPly54

 

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


  • Read our Rules
  • Activity

    1. 3

      Quest Craft

    2. 3

      Quest Craft

    3. 414

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    4. 11

      Metin2 Patcher with Electron

    5. 17

      I Want Find freebsd 11.4 with remove unnecessary codes

    6. 17

      I Want Find freebsd 11.4 with remove unnecessary codes

    7. 3

      Quest Craft

  • Recently Browsing

    • No registered users viewing this page.

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.