Guest User

Untitled

a guest
Jan 4th, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.88 KB | None | 0 0
  1. local Short = {}
  2.  
  3. Short.Comma = function(Value)
  4. local Number
  5. local Formatted = Value
  6. while true do
  7. Formatted, Number = string.gsub(Formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
  8. if (Number == 0) then
  9. break
  10. end
  11. end
  12. return Formatted
  13. end
  14.  
  15. function addComas(str)
  16. return #str % 3 == 0 and str:reverse():gsub("(%d%d%d)", "%1,"):reverse():sub(2) or str:reverse():gsub("(%d%d%d)", "%1,"):reverse()
  17. end
  18.  
  19. local function roundWhole(n)
  20. return math.floor(n + 0.5)
  21. end
  22.  
  23. local function roundDecimal(t)
  24. return math.floor(t * 10) * 0.1
  25. end
  26.  
  27. Short.en = function(Input)
  28. if Input < -1e3 then
  29. Input = roundWhole(tonumber(Input))
  30. Input = addComas(tostring(Input))
  31.  
  32. elseif Input < 0 and Input >= -1e3 then
  33. Input = roundDecimal(tonumber(Input))
  34.  
  35. elseif Input < 1e3 and Input >= 0 then
  36. Input = roundDecimal(tonumber(Input))
  37.  
  38. elseif Input < 1e6 and Input >= 1e3 then
  39. Input = roundWhole(tonumber(Input))
  40. Input = addComas(tostring(Input))
  41.  
  42. elseif Input < 1e9 and Input >= 1e6 then
  43. Input = tostring(Input/1e6):sub(1,5) .. "M"
  44.  
  45. elseif Input < 1e12 and Input >= 1e9 then
  46. Input = tostring(Input/1e9):sub(1,5) .. "B"
  47.  
  48. elseif Input < 1e15 and Input >= 1e12 then
  49. Input = tostring(Input/1e12):sub(1,5) .. "T"
  50.  
  51. elseif Input < 1e18 and Input >= 1e15 then
  52. Input = tostring(Input/1e15):sub(1,5) .. "Qd"
  53.  
  54. elseif Input < 1e21 and Input >= 1e18 then
  55. Input = tostring(Input/1e18):sub(1,5) .. "Qn"
  56.  
  57. elseif Input < 1e24 and Input >= 1e21 then
  58. Input = tostring(Input/1e21):sub(1,5) .. "Sx"
  59.  
  60. elseif Input < 1e27 and Input >= 1e24 then
  61. Input = tostring(Input/1e24):sub(1,5) .. "Sp"
  62.  
  63. elseif Input < 1e30 and Input >= 1e27 then
  64. Input = tostring(Input/1e27):sub(1,5) .. "Oc"
  65.  
  66. elseif Input < 1e33 and Input >= 1e30 then
  67. Input = tostring(Input/1e30):sub(1,5) .. "No"
  68.  
  69. elseif Input < 1e36 and Input >= 1e33 then
  70. Input = tostring(Input/1e33):sub(1,5) .. "De"
  71.  
  72. elseif Input < 1e39 and Input >= 1e36 then
  73. Input = tostring(Input/1e36):sub(1,5) .. "UDe"
  74.  
  75. elseif Input < 1e42 and Input >= 1e39 then
  76. Input = tostring(Input/1e39):sub(1,5) .. "DDe"
  77.  
  78. elseif Input < 1e45 and Input >= 1e42 then
  79. Input = tostring(Input/1e42):sub(1,5) .. "TDe"
  80.  
  81. elseif Input < 1e48 and Input >= 1e45 then
  82. Input = tostring(Input/1e45):sub(1,5) .. "QtDe"
  83.  
  84. elseif Input < 1e51 and Input >= 1e48 then
  85. Input = tostring(Input/1e48):sub(1,5) .. "QnDe"
  86.  
  87. elseif Input < 1e54 and Input >= 1e51 then
  88. Input = tostring(Input/1e51):sub(1,5) .. "SxDe"
  89.  
  90. elseif Input < 1e57 and Input >= 1e54 then
  91. Input = tostring(Input/1e54):sub(1,5) .. "SpDe"
  92.  
  93. elseif Input < 1e60 and Input >= 1e57 then
  94. Input = tostring(Input/1e57):sub(1,5) .. "OcDe"
  95.  
  96. elseif Input < 1e63 and Input >= 1e60 then
  97. Input = tostring(Input/1e60):sub(1,5) .. "NoDe"
  98.  
  99. elseif Input < 1e66 and Input >= 1e63 then
  100. Input = tostring(Input/1e63):sub(1,5) .. "Vg"
  101.  
  102. elseif Input < 1e69 and Input >= 1e66 then
  103. Input = tostring(Input/1e66):sub(1,5) .. "UVg"
  104.  
  105. elseif Input < 1e72 and Input >= 1e69 then
  106. Input = tostring(Input/1e69):sub(1,5) .. "DVg"
  107.  
  108. elseif Input < 1e75 and Input >= 1e72 then
  109. Input = tostring(Input/1e72):sub(1,5) .. "TVg"
  110.  
  111. elseif Input < 1e78 and Input >= 1e75 then
  112. Input = tostring(Input/1e75):sub(1,5) .. "QtVg"
  113.  
  114. elseif Input < 1e81 and Input >= 1e78 then
  115. Input = tostring(Input/1e78):sub(1,5) .. "QnVg"
  116.  
  117. elseif Input < 1e84 and Input >= 1e81 then
  118. Input = tostring(Input/1e81):sub(1,5) .. "SxVg"
  119.  
  120. elseif Input < 1e87 and Input >= 1e84 then
  121. Input = tostring(Input/1e84):sub(1,5) .. "SpVg"
  122.  
  123. elseif Input < 1e90 and Input >= 1e87 then
  124. Input = tostring(Input/1e87):sub(1,5) .. "OcVg"
  125.  
  126. elseif Input < 1e93 and Input >= 1e90 then
  127. Input = tostring(Input/1e90):sub(1,5) .. "NoVg"
  128.  
  129. elseif Input < 1e96 and Input >= 1e93 then
  130. Input = tostring(Input/1e93):sub(1,5) .. "Tg"
  131.  
  132. elseif Input < 1e99 and Input >= 1e96 then
  133. Input = tostring(Input/1e96):sub(1,5) .. "UTg"
  134.  
  135. elseif Input < 1e102 and Input >= 1e99 then
  136. Input = tostring(Input/1e99):sub(1,5) .. "DTg"
  137.  
  138. elseif Input < 1e105 and Input >= 1e102 then
  139. Input = tostring(Input/1e102):sub(1,5) .. "TTg"
  140.  
  141. elseif Input < 1e108 and Input >= 1e105 then
  142. Input = tostring(Input/1e105):sub(1,5) .. "QdTg"
  143.  
  144. elseif Input < 1e111 and Input >= 1e108 then
  145. Input = tostring(Input/1e108):sub(1,5) .. "QnTg"
  146.  
  147. elseif Input < 1e114 and Input >= 1e111 then
  148. Input = tostring(Input/1e111):sub(1,5) .. "SxTg"
  149.  
  150. elseif Input < 1e117 and Input >= 1e114 then
  151. Input = tostring(Input/1e114):sub(1,5) .. "SpTg"
  152.  
  153. elseif Input < 1e120 and Input >= 1e117 then
  154. Input = tostring(Input/1e117):sub(1,5) .. "OcTg"
  155.  
  156. elseif Input < 1e123 and Input >= 1e120 then
  157. Input = tostring(Input/1e120):sub(1,5) .. "NoTg"
  158.  
  159. elseif Input < 1e126 and Input >= 1e123 then
  160. Input = tostring(Input/1e123):sub(1,5) .. "qg"
  161.  
  162. elseif Input < 1e129 and Input >= 1e126 then
  163. Input = tostring(Input/1e126):sub(1,5) .. "Uqg"
  164.  
  165. elseif Input < 1e132 and Input >= 1e129 then
  166. Input = tostring(Input/1e129):sub(1,5) .. "Dqg"
  167.  
  168. elseif Input < 1e135 and Input >= 1e132 then
  169. Input = tostring(Input/1e132):sub(1,5) .. "Tqg"
  170.  
  171. elseif Input < 1e138 and Input >= 1e135 then
  172. Input = tostring(Input/1e135):sub(1,5) .. "Qdqg"
  173.  
  174. elseif Input < 1e141 and Input >= 1e138 then
  175. Input = tostring(Input/1e138):sub(1,5) .. "Qnqg"
  176.  
  177. elseif Input < 1e144 and Input >= 1e141 then
  178. Input = tostring(Input/1e141):sub(1,5) .. "Sxqg"
  179.  
  180. elseif Input < 1e147 and Input >= 1e144 then
  181. Input = tostring(Input/1e144):sub(1,5) .. "Spqg"
  182.  
  183. elseif Input < 1e150 and Input >= 1e147 then
  184. Input = tostring(Input/1e147):sub(1,5) .. "Ocqg"
  185.  
  186. elseif Input < 1e153 and Input >= 1e150 then
  187. Input = tostring(Input/1e150):sub(1,5) .. "Noqg"
  188.  
  189. elseif Input < 1e156 and Input >= 1e153 then
  190. Input = tostring(Input/1e153):sub(1,5) .. "Qg"
  191.  
  192. elseif Input < 1e159 and Input >= 1e156 then
  193. Input = tostring(Input/1e156):sub(1,5) .. "UQg"
  194.  
  195. elseif Input < 1e162 and Input >= 1e159 then
  196. Input = tostring(Input/1e159):sub(1,5) .. "DQg"
  197.  
  198. elseif Input < 1e165 and Input >= 1e162 then
  199. Input = tostring(Input/1e162):sub(1,5) .. "TQg"
  200.  
  201. elseif Input < 1e168 and Input >= 1e165 then
  202. Input = tostring(Input/1e165):sub(1,5) .. "QdQg"
  203.  
  204. elseif Input < 1e171 and Input >= 1e168 then
  205. Input = tostring(Input/1e168):sub(1,5) .. "QnQg"
  206.  
  207. elseif Input < 1e174 and Input >= 1e171 then
  208. Input = tostring(Input/1e171):sub(1,5) .. "SxQg"
  209.  
  210. elseif Input < 1e177 and Input >= 1e174 then
  211. Input = tostring(Input/1e174):sub(1,5) .. "SpQg"
  212.  
  213. elseif Input < 1e180 and Input >= 1e177 then
  214. Input = tostring(Input/1e177):sub(1,5) .. "OcQg"
  215.  
  216. elseif Input < 1e183 and Input >= 1e180 then
  217. Input = tostring(Input/1e180):sub(1,5) .. "NoQg"
  218.  
  219. elseif Input < 1e186 and Input >= 1e183 then
  220. Input = tostring(Input/1e183):sub(1,5) .. "sg"
  221.  
  222. elseif Input < 1e189 and Input >= 1e186 then
  223. Input = tostring(Input/1e186):sub(1,5) .. "Usg"
  224.  
  225. elseif Input < 1e192 and Input >= 1e189 then
  226. Input = tostring(Input/1e189):sub(1,5) .. "Dsg"
  227.  
  228. elseif Input < 1e195 and Input >= 1e192 then
  229. Input = tostring(Input/1e192):sub(1,5) .. "Tsg"
  230.  
  231. elseif Input < 1e198 and Input >= 1e195 then
  232. Input = tostring(Input/1e195):sub(1,5) .. "Qdsg"
  233.  
  234. elseif Input < 1e201 and Input >= 1e198 then
  235. Input = tostring(Input/1e198):sub(1,5) .. "Qnsg"
  236.  
  237. elseif Input < 1e204 and Input >= 1e201 then
  238. Input = tostring(Input/1e201):sub(1,5) .. "Sxsg"
  239.  
  240. elseif Input < 1e207 and Input >= 1e204 then
  241. Input = tostring(Input/1e204):sub(1,5) .. "Spsg"
  242.  
  243. elseif Input < 1e210 and Input >= 1e207 then
  244. Input = tostring(Input/1e207):sub(1,5) .. "Ocsg"
  245.  
  246. elseif Input < 1e213 and Input >= 1e210 then
  247. Input = tostring(Input/1e210):sub(1,5) .. "Nosg"
  248.  
  249. elseif Input < 1e216 and Input >= 1e213 then
  250. Input = tostring(Input/1e213):sub(1,5) .. "Sg"
  251.  
  252. elseif Input < 1e219 and Input >= 1e216 then
  253. Input = tostring(Input/1e216):sub(1,5) .. "USg"
  254.  
  255. elseif Input < 1e222 and Input >= 1e219 then
  256. Input = tostring(Input/1e219):sub(1,5) .. "DSg"
  257.  
  258. elseif Input < 1e225 and Input >= 1e222 then
  259. Input = tostring(Input/1e222):sub(1,5) .. "TSg"
  260.  
  261. elseif Input < 1e228 and Input >= 1e225 then
  262. Input = tostring(Input/1e225):sub(1,5) .. "QdSg"
  263.  
  264. elseif Input < 1e231 and Input >= 1e228 then
  265. Input = tostring(Input/1e228):sub(1,5) .. "QnSg"
  266.  
  267. elseif Input < 1e234 and Input >= 1e231 then
  268. Input = tostring(Input/1e231):sub(1,5) .. "SxSg"
  269.  
  270. elseif Input < 1e237 and Input >= 1e234 then
  271. Input = tostring(Input/1e234):sub(1,5) .. "SpSg"
  272.  
  273. elseif Input < 1e240 and Input >= 1e237 then
  274. Input = tostring(Input/1e237):sub(1,5) .. "OcSg"
  275.  
  276. elseif Input < 1e243 and Input >= 1e240 then
  277. Input = tostring(Input/1e240):sub(1,5) .. "NoSg"
  278.  
  279. elseif Input < 1e246 and Input >= 1e243 then
  280. Input = tostring(Input/1e243):sub(1,5) .. "Og"
  281.  
  282. elseif Input < 1e249 and Input >= 1e246 then
  283. Input = tostring(Input/1e246):sub(1,5) .. "UOg"
  284.  
  285. elseif Input < 1e252 and Input >= 1e249 then
  286. Input = tostring(Input/1e249):sub(1,5) .. "DOg"
  287.  
  288. elseif Input < 1e255 and Input >= 1e252 then
  289. Input = tostring(Input/1e252):sub(1,5) .. "TOg"
  290.  
  291. elseif Input < 1e258 and Input >= 1e255 then
  292. Input = tostring(Input/1e255):sub(1,5) .. "QdOg"
  293.  
  294. elseif Input < 1e261 and Input >= 1e258 then
  295. Input = tostring(Input/1e258):sub(1,5) .. "QnOg"
  296.  
  297. elseif Input < 1e264 and Input >= 1e261 then
  298. Input = tostring(Input/1e261):sub(1,5) .. "SxOg"
  299.  
  300. elseif Input < 1e267 and Input >= 1e264 then
  301. Input = tostring(Input/1e264):sub(1,5) .. "SpOg"
  302.  
  303. elseif Input < 1e270 and Input >= 1e267 then
  304. Input = tostring(Input/1e267):sub(1,5) .. "OcOg"
  305.  
  306. elseif Input < 1e273 and Input >= 1e270 then
  307. Input = tostring(Input/1e270):sub(1,5) .. "NoOg"
  308.  
  309. elseif Input < 1e276 and Input >= 1e273 then
  310. Input = tostring(Input/1e273):sub(1,5) .. "Ng"
  311.  
  312. elseif Input < 1e279 and Input >= 1e276 then
  313. Input = tostring(Input/1e276):sub(1,5) .. "UNg"
  314.  
  315. elseif Input < 1e282 and Input >= 1e279 then
  316. Input = tostring(Input/1e279):sub(1,5) .. "DNg"
  317.  
  318. elseif Input < 1e285 and Input >= 1e282 then
  319. Input = tostring(Input/1e282):sub(1,5) .. "TNg"
  320.  
  321. elseif Input < 1e288 and Input >= 1e285 then
  322. Input = tostring(Input/1e285):sub(1,5) .. "QdNg"
  323.  
  324. elseif Input < 1e291 and Input >= 1e288 then
  325. Input = tostring(Input/1e288):sub(1,5) .. "QnNg"
  326.  
  327. elseif Input < 1e294 and Input >= 1e291 then
  328. Input = tostring(Input/1e291):sub(1,5) .. "SxNg"
  329.  
  330. elseif Input < 1e297 and Input >= 1e294 then
  331. Input = tostring(Input/1e294):sub(1,5) .. "SpNg"
  332.  
  333. elseif Input < 1e300 and Input >= 1e297 then
  334. Input = tostring(Input/1e297):sub(1,5) .. "OcNg"
  335.  
  336. elseif Input < 1e303 and Input >= 1e300 then
  337. Input = tostring(Input/1e300):sub(1,5) .. "NoNg"
  338.  
  339. elseif Input < 1e306 and Input >= 1e303 then
  340. Input = tostring(Input/1e303):sub(1,5) .. "Ce"
  341.  
  342. elseif Input < 1.7976931348e308 and Input >= 1e306 then
  343. Input = addComas(tostring(Input/1e303):sub(1,5)) .. "Ce"
  344.  
  345. elseif Input >= 1.7976931348e308 then
  346. Input = "Infinite"
  347. end
  348.  
  349. return Input
  350. end
  351.  
  352. return Short
Add Comment
Please, Sign In to add comment