-
-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update(math): group digits #338
Conversation
Credits for the formatting goes https://stackoverflow.com/questions/10989788/format-integer-in-lua |
i have no idea why did I think it was a good idea in first place
The number type-check is san issue, if say you want to group This one from lua-users is more robust https://lua-users.org/wiki/FormattingNumbers. function comma_value(n) -- credit http://richard.warburton.it
local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end |
hawaii weather pr |
???? |
imports/math/shared.lua
Outdated
function math.groupdigits(number, useDot) -- credit http://richard.warburton.it | ||
local divider = useDot and '.' or ',' | ||
local left,num,right = string.match(number,'^([^%d]*%d)(%d*)(.-)$') | ||
return left..(num:reverse():gsub('(%d%d%d)','%1' .. divider):reverse())..right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well be divider
or seperator
as the arg (not useDot), and then just do '%1' .. (divider or ',')
.
commit 7816ce7 Author: Luke <[email protected]> Date: Sun Jun 11 10:29:59 2023 +0200 fix(web): cap list menu width for long labeled items resolves overextended#350 commit bc4a342 Author: Luke <[email protected]> Date: Sun Jun 11 10:29:42 2023 +0200 chore(web): update lockfile version commit cfb75b2 Author: EP <[email protected]> Date: Tue May 30 00:28:57 2023 +0300 chore(locales): Finnish locales (overextended#342) commit 1bf366c Author: Manifest Bumper <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun May 28 05:16:17 2023 +0000 chore: bump manifest version to v3.6.0 commit 8ec19cf Author: Linden <[email protected]> Date: Sun May 28 15:14:52 2023 +1000 feat(imports/table): readonly tables commit 26065fe Author: Jerry <[email protected]> Date: Sun May 28 13:08:56 2023 +0800 chore(locales): update zh-cn.json and zh-tw.json (overextended#337) commit 6486f99 Author: daZepelin <[email protected]> Date: Sun May 28 08:08:40 2023 +0300 feat(server/cron): getAbsoluteNextTime (overextended#319) commit 6cf53dd Author: Linden <[email protected]> Date: Sun May 28 15:02:54 2023 +1000 fix(client/vehicleProperties): mods not applying commit 4fed5dc Author: mikigoalie <[email protected]> Date: Fri May 26 01:06:28 2023 +0200 feat(imports/math): groupdigits (overextended#338) commit 467e7f5 Author: Can Sönmez <[email protected]> Date: Fri May 26 02:04:30 2023 +0300 fix(package/callback): await callback response (overextended#340) commit a8ab102 Author: Linden <[email protected]> Date: Thu May 25 14:56:15 2023 +1000 refactor(imports/streaming): use coroutine.isyieldable commit 9efcde0 Author: Manifest Bumper <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun May 21 21:02:45 2023 +0000 chore: bump manifest version to v3.5.0 commit 4953eac Author: Nuga <[email protected]> Date: Mon May 22 00:01:03 2023 +0300 chore(locales): update et.json (overextended#335) commit 1ba5787 Author: Linden <[email protected]> Date: Mon May 22 06:47:57 2023 +1000 feat(imports): extended math lib commit 4e4b5bd Author: Linden <[email protected]> Date: Mon May 22 04:55:31 2023 +1000 fix(client/vehicleProperties): tonumber for extras and tyres Sparse arrays sometimes json.decode with string keys, i.e. `{[5] = 1, [10] = 1}` becomes `[null,null,null,null,1,null,null,null,null,1]` `{[10] = 1, [11] = 1}` becomes `{"10":1,"11":1}` commit b4edc5b Author: Linden <[email protected]> Date: Mon May 22 03:38:36 2023 +1000 feat(client/vehicleProperties): support extra props Add modKit and bulletProofTyres. commit 3bc9c32 Author: Linden <[email protected]> Date: Mon May 22 03:34:21 2023 +1000 fix(client/vehicleProperties): missing tyres commit c0ee1ae Author: Linden <[email protected]> Date: Mon May 22 03:27:47 2023 +1000 fix(client/vehicleProperties): SetVehicleExtra takes bool commit dbfb022 Author: Linden <[email protected]> Date: Fri May 19 21:41:58 2023 +1000 refactor(cleint/textui): cancel showTextUI if text is unchanged Because people continue to excessively call it in a loop. commit 21c835b Author: Manifest Bumper <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu May 18 11:36:43 2023 +0000 chore: bump manifest version to v3.4.1 commit 06e8f66 Author: Luke <[email protected]> Date: Thu May 18 13:34:44 2023 +0200 ci(release): install package deps commit ca991bf Author: Demetrio <[email protected]> Date: Thu May 18 13:35:06 2023 +0200 fix(client/imports): correct return value for getClosestPed (overextended#334) commit d68e544 Author: Manifest Bumper <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu May 18 11:19:45 2023 +0000 chore: bump manifest version to v3.4.0 commit ebd97f0 Author: Linden <[email protected]> Date: Thu May 18 21:10:20 2023 +1000 feat(client/imports): getClosestPed commit 4d1f395 Author: Demetrio <[email protected]> Date: Thu May 18 13:06:21 2023 +0200 feat(client/imports): getNearbyPeds (overextended#328) commit fa589f5 Author: Maciej Ratyński <[email protected]> Date: Thu May 18 13:03:37 2023 +0200 chore(locales): update pl.json (overextended#332) commit af9828b Author: mikigoalie <[email protected]> Date: Thu May 18 13:03:13 2023 +0200 chore(locales): cs.json (overextended#333) commit 991be22 Author: Linden <[email protected]> Date: Thu May 18 21:02:27 2023 +1000 fix(client/radial): disable pause menu while open commit 71f751c Author: Linden <[email protected]> Date: Thu May 18 18:44:23 2023 +1000 chore: readme commit 16875ca Author: Linden <[email protected]> Date: Thu May 18 15:29:31 2023 +1000 fix: type corrections commit 72d0671 Author: dntAtMe <[email protected]> Date: Wed May 17 22:31:54 2023 +0200 feat(locales): polish locales (overextended#330) commit b4d9cff Author: Demetrio <[email protected]> Date: Fri May 12 05:10:28 2023 +0200 fix(server/txadmin): notification override convar (overextended#325) commit 2199079 Author: LukeWasTaken <[email protected]> Date: Wed May 10 16:25:30 2023 +0200 feat(web): ability to style description in notifications commit 8a8700c Author: Demetrio <[email protected]> Date: Tue May 9 15:52:09 2023 +0200 feat(server/interface): configurable txAdmin notifications override (overextended#299) commit 361ce6c Author: Linden <[email protected]> Date: Tue May 9 09:04:45 2023 +1000 chore(imports/table): some types and annotations commit 62cde22 Author: Andyyy7666 <[email protected]> Date: Tue May 9 00:41:01 2023 +0200 chore(locales): translate untranslated string (overextended#323) commit bcb522d Author: LukeWasTaken <[email protected]> Date: Tue May 9 00:12:55 2023 +0200 fix(fix): fix potential package prepublish fix commit 5af7b3d Author: Manifest Bumper <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon May 8 22:02:50 2023 +0000 chore: bump manifest version to v3.3.0 commit 9a0fc24 Author: Lockwood <[email protected]> Date: Mon May 8 23:00:47 2023 +0100 feat(interface/input): minLength & maxLength option (overextended#286) commit 1d65379 Author: mikigoalie <[email protected]> Date: Mon May 8 23:59:58 2023 +0200 chore(locales/cs): more translation (overextended#321) commit b314b0a Author: LukeWasTaken <[email protected]> Date: Mon May 8 23:58:41 2023 +0200 fix(package): potential fix for the npm package being uncompiled commit a557f33 Author: LukeWasTaken <[email protected]> Date: Mon May 8 23:57:42 2023 +0200 chore(package): update to pnpm v8 commit 56536d5 Author: daZepelin <[email protected]> Date: Fri May 5 16:12:01 2023 +0300 refactor(server/logger): backwards compatibility for loki convar (overextended#314) commit 89c0668 Author: Linden <[email protected]> Date: Fri May 5 14:53:29 2023 +1000 refactor(client/progress): reduce Wait in progress queue commit 8787638 Author: Linden <[email protected]> Date: Fri May 5 14:51:52 2023 +1000 refactor(client/progress): don't clear progress on cancel Sending "progressCancel" to NUI will cause a transition and then trigger "progressComplete" with a slight delay (~100ms). Should look better when people queue up progress bars. commit c94d019 Author: mikigoalie <[email protected]> Date: Mon May 1 12:08:02 2023 +0200 feat(web/notifications): add warning type (overextended#315) * update(notify): add warning it's own type * update(notify): inform > info, change warning default icon to circle * fix typo * update(notify): case for def notifs, update icons use circle icons for all notifs so its more unified, also looks a bit better imo * fix(progressBar): spamming cancel spamming cancel would sometimes not interrupt current progbar * Revert "fix(progressBar): spamming cancel" This reverts commit b030fdd. commit 073a3d0 Author: LukeWasTaken <[email protected]> Date: Mon May 1 11:11:04 2023 +0200 chore(web): update pnpm version commit bda2c26 Author: Jag <[email protected]> Date: Mon May 1 02:07:17 2023 -0700 feat(web/radial): newlines support (overextended#316) * feat(radial): Support newlines * chore: update to ` \n` to match markdown commit 60ef88c Author: Cherry <[email protected]> Date: Mon May 1 10:59:41 2023 +0200 chore(locales/es): add missing translation (overextended#312) commit 4b2a09c Author: Kenneth Iversen <[email protected]> Date: Mon May 1 10:59:10 2023 +0200 feat(locales): norwegian locales (overextended#313) Co-authored-by: actstorm <[email protected]>
thought it'd be a good idea to include this in math lib