From 0e6df8c5e7a186e2f23cebf21c8d5b116878556e Mon Sep 17 00:00:00 2001
From: Reza Behzadan <rbehzadan@gmail.com>
Date: Sat, 16 May 2020 18:41:42 +0430
Subject: [PATCH] constructor accepts thousands separator in string

---
 bigint.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bigint.lua b/bigint.lua
index 7ca18f7..09fd111 100644
--- a/bigint.lua
+++ b/bigint.lua
@@ -27,7 +27,7 @@ local function num2tab(n)
 end
 
 local function str2tab(s)
-    local s = string.match(s, "^[+-]?%d+$") or "0"
+    local s = s:gsub("[ ,]", ""):match("^[+-]?%d+$") or "0"
     local t = {sign=1}
     local i = #s
     local j = 1