Advertisement
BobMe

spanish numbers thing

Sep 4th, 2019
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. -- spanish numbers thing (i take spanish ok?)
  2.  
  3. local tens = {"","","treinta","cuarenta","cincuenta","sesenta","setenta","ochenta","noventa","cien"}
  4. local ones = {" y uno"," y dos"," y tres"," y cuatro"," y cinco"," y sies"," y siete"," y ocho"," y nueve"}
  5.  
  6. -- first 1-20
  7.  
  8. print("1 | uno")
  9. print("2 | dos")
  10. print("3 | tres")
  11. print("4 | cuatro")
  12. print("5 | cinco")
  13. print("6 | sies")
  14. print("7 | siente")
  15. print("8 | ocho")
  16. print("9 | nueve")
  17. print("10 | diez")
  18. print("11 | once")
  19. print("12 | doce")
  20. print("13 | trece")
  21. print("14 | catorce")
  22. print("15 | quince")
  23. print("16 | dieciséis")
  24. print("17 | diecisiete")
  25. print("18 | dieciocho")
  26. print("19 | diecinueve")
  27. print("20 | veinte")
  28. print("21 | veintiuno")
  29. print("22 | veintidós")
  30. print("23 | veintitrés")
  31. print("24 | veinticuatro")
  32. print("25 | veinticinco")
  33. print("26 | veintiséis")
  34. print("27 | veintisiete")
  35. print("28 | veintiocho")
  36. print("29 | veintinueve")
  37.  
  38. function numstr(x)
  39. return tostring(x)
  40. end
  41.  
  42. function seperate(x)
  43. x = tostring(x)
  44. x = string.sub(x,1,1)
  45. return tonumber(x)
  46. end
  47.  
  48. function seperatet(x)
  49. x = tostring(x)
  50. x = string.sub(x,2,2)
  51. return tonumber(x)
  52. end
  53.  
  54. local number = 30
  55.  
  56. while number ~= 100 do
  57. if string.sub(numstr(number),2,2) == "0" then
  58. print(number.." | "..tens[seperate(number)])
  59. number = number + 1
  60. else
  61. print(number.." | "..tens[seperate(number)]..ones[seperatet(number)])
  62. number = number + 1
  63. end
  64. end
  65.  
  66. print("100 | cien")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement