From a72d8ccbf9488aa457297a38e5b726946651c3b1 Mon Sep 17 00:00:00 2001 From: frostice482 Date: Thu, 30 Oct 2025 21:05:40 +0700 Subject: [PATCH 1/5] introduce is_big --- talisman.lua | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/talisman.lua b/talisman.lua index f356790..2720c9e 100644 --- a/talisman.lua +++ b/talisman.lua @@ -204,7 +204,7 @@ function lenient_bignum(x) local l10 = math.log10 function math.log10(x) - if type(x) == 'table' then + if type(x) == 'table' then if x.log10 then return lenient_bignum(x:log10()) end return lenient_bignum(l10(math.min(x:to_number(),1e300))) end @@ -214,7 +214,7 @@ function lenient_bignum(x) local lg = math.log function math.log(x, y) if not y then y = 2.718281828459045 end - if type(x) == 'table' then + if type(x) == 'table' then if x.log then return lenient_bignum(x:log(to_big(y))) end if x.logBase then return lenient_bignum(x:logBase(to_big(y))) end return lenient_bignum(lg(math.min(x:to_number(),1e300),y)) @@ -224,13 +224,13 @@ function lenient_bignum(x) function math.exp(x) local big_e = to_big(2.718281828459045) - + if type(big_e) == "number" then return lenient_bignum(big_e ^ x) else return lenient_bignum(big_e:pow(x)) end - end + end if SMODS then function SMODS.get_blind_amount(ante) @@ -246,9 +246,9 @@ function lenient_bignum(x) to_big(10000 + 25000*(scale+1)*((scale/4)^2)), to_big(50000 * (scale+1)^2 * (scale/7)^2) } - + if ante < 1 then return to_big(100) end - if ante <= 8 then + if ante <= 8 then local amount = amounts[ante] if (amount:lt(R.E_MAX_SAFE_INTEGER)) then local exponent = to_big(10)^(math.floor(amount:log10() - to_big(1))):to_number() @@ -274,7 +274,7 @@ function lenient_bignum(x) if G.GAME.modifiers.scaling and (G.GAME.modifiers.scaling ~= 1 and G.GAME.modifiers.scaling ~= 2 and G.GAME.modifiers.scaling ~= 3) then return SMODS.get_blind_amount(ante) end if type(to_big(1)) == 'number' then return gba(ante) end local k = to_big(0.75) - if not G.GAME.modifiers.scaling or G.GAME.modifiers.scaling == 1 then + if not G.GAME.modifiers.scaling or G.GAME.modifiers.scaling == 1 then local amounts = { to_big(300), to_big(800), to_big(2000), to_big(5000), to_big(11000), to_big(20000), to_big(35000), to_big(50000) } @@ -288,7 +288,7 @@ function lenient_bignum(x) end amount:normalize() return amount - elseif G.GAME.modifiers.scaling == 2 then + elseif G.GAME.modifiers.scaling == 2 then local amounts = { to_big(300), to_big(900), to_big(2600), to_big(8000), to_big(20000), to_big(36000), to_big(60000), to_big(100000) --300, 900, 2400, 7000, 18000, 32000, 56000, 90000 @@ -303,7 +303,7 @@ function lenient_bignum(x) end amount:normalize() return amount - elseif G.GAME.modifiers.scaling == 3 then + elseif G.GAME.modifiers.scaling == 3 then local amounts = { to_big(300), to_big(1000), to_big(3200), to_big(9000), to_big(25000), to_big(60000), to_big(110000), to_big(200000) --300, 1000, 3000, 8000, 22000, 50000, 90000, 180000 @@ -431,7 +431,7 @@ function lenient_bignum(x) return sqrt(x) end - + local old_abs = math.abs function math.abs(x) @@ -446,10 +446,12 @@ function lenient_bignum(x) end end +function is_big(x) + return type(x) == 'table' and ((x.e and x.m) or (x.array and x.sign)) +end + function is_number(x) - if type(x) == 'number' then return true end - if type(x) == 'table' and ((x.e and x.m) or (x.array and x.sign)) then return true end - return false + return type(x) == 'number' or is_big(x) end function to_big(x, y) @@ -645,7 +647,7 @@ if not Talisman.F_NO_COROUTINE then G.SCORING_TEXT = nil if not G.OVERLAY_MENU then G.scoring_text = {localize("talisman_string_D"), "", "", ""} - G.SCORING_TEXT = { + G.SCORING_TEXT = { {n = G.UIT.C, nodes = { {n = G.UIT.R, config = {padding = 0.1, align = "cm"}, nodes = { {n=G.UIT.O, config={object = DynaText({string = {{ref_table = G.scoring_text, ref_value = 1}}, colours = {G.C.UI.TEXT_LIGHT}, shadow = true, pop_in = 0, scale = 1, silent = true})}}, @@ -665,8 +667,8 @@ if not Talisman.F_NO_COROUTINE then })}}, }}} G.FUNCS.overlay_menu({ - definition = - {n=G.UIT.ROOT, minw = G.ROOM.T.w*5, minh = G.ROOM.T.h*5, config={align = "cm", padding = 9999, offset = {x = 0, y = -3}, r = 0.1, colour = {G.C.GREY[1], G.C.GREY[2], G.C.GREY[3],0.7}}, nodes= G.SCORING_TEXT}, + definition = + {n=G.UIT.ROOT, minw = G.ROOM.T.w*5, minh = G.ROOM.T.h*5, config={align = "cm", padding = 9999, offset = {x = 0, y = -3}, r = 0.1, colour = {G.C.GREY[1], G.C.GREY[2], G.C.GREY[3],0.7}}, nodes= G.SCORING_TEXT}, config = {align="cm", offset = {x=0,y=0}, major = G.ROOM_ATTACH, bond = 'Weak'} }) else @@ -691,9 +693,9 @@ if not Talisman.F_NO_COROUTINE then --event queue overhead seems to not exist if Talismans Disable Scoring Animations is off. --event manager has to wait for scoring to finish until it can keep processing events anyways. - + G.LAST_SCORING_YIELD = love.timer.getTime() - + local success, msg = coroutine.resume(G.SCORING_COROUTINE) if not success then error(msg) From c83aaca83fe08639577d4024662e9c5389556138 Mon Sep 17 00:00:00 2001 From: frostice482 Date: Thu, 30 Oct 2025 21:09:39 +0700 Subject: [PATCH 2/5] change table checks --- big-num/bignumber.lua | 4 ++-- big-num/notations/Balatro.lua | 2 +- big-num/omeganum.lua | 10 +++++----- lovely.toml | 32 ++++++++++++++++---------------- talisman.lua | 28 ++++++++++++++-------------- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/big-num/bignumber.lua b/big-num/bignumber.lua index 968027b..07b5bc7 100644 --- a/big-num/bignumber.lua +++ b/big-num/bignumber.lua @@ -12,7 +12,7 @@ BigMeta.__index = Big -- -- numbers are stored in the form `m * 10 ^ e` function Big:new(m, e) - if type(m) == "table" then + if is_big(m) then return setmetatable({m = m.m, e = m.e}, BigMeta):normalized() end if e == nil then e = 0 end @@ -146,7 +146,7 @@ function Big:pow(pow) end function BigMeta.__pow(b1, n) - if type(n) == "table" then n = n:to_number() end + if is_big(n) then n = n:to_number() end if type(b1) ~= "table" then b1 = Big:new(b1) end return b1:pow(n) end diff --git a/big-num/notations/Balatro.lua b/big-num/notations/Balatro.lua index 7e7757e..8e6196f 100644 --- a/big-num/notations/Balatro.lua +++ b/big-num/notations/Balatro.lua @@ -16,7 +16,7 @@ function BalaNotation:format(n, places) --vanilla balatro number_format function basically local function e_ify(num) --if not num then return "0" end - if type(num) == "table" then + if is_big(num) then num = num:to_number() end if (num or 0) >= 10^6 then diff --git a/big-num/omeganum.lua b/big-num/omeganum.lua index 4d1ea82..a1aaa68 100644 --- a/big-num/omeganum.lua +++ b/big-num/omeganum.lua @@ -138,7 +138,7 @@ function Big:compareTo(other) elseif (self_array_size other.array[1] then return 1 * m elseif self.array[1] < other.array[1] then @@ -610,7 +610,7 @@ function Big:create(input) return Big:new({input}) elseif ((type(input) == "string")) then return Big:parse(input) - elseif ((type(input) == "table") and getmetatable(input) == OmegaMeta) then + elseif ((is_big(input)) and getmetatable(input) == OmegaMeta) then return input:clone() else return Big:new(input) @@ -618,7 +618,7 @@ function Big:create(input) end function Big:ensureBig(input) - if ((type(input) == "table") and getmetatable(input) == OmegaMeta) then + if ((is_big(input)) and getmetatable(input) == OmegaMeta) then return input else return Big:create(input) @@ -1135,7 +1135,7 @@ function Big:tetrate(other) end function Big:max_for_op(arrows) - if type(arrows) == "table" then + if is_big(arrows) then arrows = arrows:to_number() end if arrows < 1 or arrows ~= arrows or arrows == R.POSITIVE_INFINITY then @@ -1158,7 +1158,7 @@ function Big:max_for_op(arrows) local limit = math.floor(math.log(arrows, 10)) for i = 6, limit do arr[10^i] = 8 - end + end end arr[arrows - 1] = 8 diff --git a/lovely.toml b/lovely.toml index 453c9ee..35db0fc 100644 --- a/lovely.toml +++ b/lovely.toml @@ -173,7 +173,7 @@ pattern = "if not G.TAROT_INTERRUPT_PULSE then G.FUNCS.text_super_juice(e, math. position = "at" payload = ''' local num = 0 -if to_big(is_number(G.GAME.current_round.current_hand.mult) and G.GAME.current_round.current_hand.mult or 1) > to_big(1e300) then +if to_big(is_number(G.GAME.current_round.current_hand.mult) and G.GAME.current_round.current_hand.mult or 1) > to_big(1e300) then num = math.min(2,math.max(0,math.floor(math.log10(is_number(G.GAME.current_round.current_hand.mult) and G.GAME.current_round.current_hand.mult or 1)))) else num = 1e300 @@ -189,7 +189,7 @@ pattern = "if not G.TAROT_INTERRUPT_PULSE then G.FUNCS.text_super_juice(e, math. position = "at" payload = ''' local num = 0 -if to_big(is_number(G.GAME.current_round.current_hand.chips) and G.GAME.current_round.current_hand.chips or 1) > to_big(1e300) then +if to_big(is_number(G.GAME.current_round.current_hand.chips) and G.GAME.current_round.current_hand.chips or 1) > to_big(1e300) then num = math.min(2,math.max(0,math.floor(math.log10(is_number(G.GAME.current_round.current_hand.chips) and G.GAME.current_round.current_hand.chips or 1)))) else num = 1e300 @@ -537,7 +537,7 @@ position = "at" payload = '''if to_big(card.unlock_condition.extra) <= to_big(G.GAME.dollars) then''' match_indent = true -# Talisman compat for vanilla jokers +# Talisman compat for vanilla jokers [[patches]] [patches.pattern] target = "card.lua" @@ -801,7 +801,7 @@ if eee_chips > 0 then end local hyper_chips = card:get_chip_hyper_bonus() -if type(hyper_chips) == 'table' and hyper_chips[1] > 0 and hyper_chips[2] > 0 then +if is_big(hyper_chips) and hyper_chips[1] > 0 and hyper_chips[2] > 0 then ret.hyper_chips = hyper_chips end @@ -821,7 +821,7 @@ if eee_mult > 0 then end local hyper_mult = card:get_chip_hyper_mult() -if type(hyper_mult) == 'table' and hyper_mult[1] > 0 and hyper_mult[2] > 0 then +if is_big(hyper_mult) and hyper_mult[1] > 0 and hyper_mult[2] > 0 then ret.hyper_mult = hyper_mult end ''' @@ -833,28 +833,28 @@ target = "functions/common_events.lua" pattern = "elseif eval_type == 'dollars' then" position = "before" payload = ''' -elseif eval_type == 'x_chips' then +elseif eval_type == 'x_chips' then sound = 'talisman_xchip' amt = amt text = 'X' .. amt colour = G.C.CHIPS config.type = 'fade' config.scale = 0.7 -elseif eval_type == 'e_chips' then +elseif eval_type == 'e_chips' then sound = 'talisman_echip' amt = amt text = '^' .. amt colour = G.C.CHIPS config.type = 'fade' config.scale = 0.7 -elseif eval_type == 'ee_chips' then +elseif eval_type == 'ee_chips' then sound = 'talisman_eechip' amt = amt text = '^^' .. amt colour = G.C.CHIPS config.type = 'fade' config.scale = 0.7 -elseif eval_type == 'eee_chips' then +elseif eval_type == 'eee_chips' then sound = 'talisman_eeechip' amt = amt text = '^^^' .. amt @@ -868,28 +868,28 @@ elseif eval_type == 'hyper_chips' then colour = G.C.CHIPS config.type = 'fade' config.scale = 0.7 -elseif eval_type == 'e_mult' then +elseif eval_type == 'e_mult' then sound = 'talisman_emult' amt = amt text = '^' .. amt .. ' ' .. localize('k_mult') colour = G.C.MULT config.type = 'fade' config.scale = 0.7 -elseif eval_type == 'ee_mult' then +elseif eval_type == 'ee_mult' then sound = 'talisman_eemult' amt = amt text = '^^' .. amt .. ' ' .. localize('k_mult') colour = G.C.MULT config.type = 'fade' config.scale = 0.7 -elseif eval_type == 'eee_mult' then +elseif eval_type == 'eee_mult' then sound = 'talisman_eeemult' amt = amt text = '^^^' .. amt .. ' ' .. localize('k_mult') colour = G.C.MULT config.type = 'fade' config.scale = 0.7 -elseif eval_type == 'hyper_mult' then +elseif eval_type == 'hyper_mult' then sound = 'talisman_eeemult' text = (amt[1] > 5 and ('{' .. tostring(amt[1]) .. '}') or string.rep('^', amt[1])) .. tostring(amt[2]) .. ' ' .. localize('k_mult') amt = amt[2] @@ -1274,7 +1274,7 @@ target = 'functions/misc_functions.lua' pattern = "assembled_string = assembled_string..(type(subpart) == 'string' and subpart or args.vars[tonumber(subpart[1])] or 'ERROR')" position = 'before' payload = ''' -if not SMODS and type(subpart) ~= 'string' then +if not SMODS and type(subpart) ~= 'string' then if type(args.vars[tonumber(subpart[ 1 ])]) ~= 'number' then args.vars[tonumber(subpart[ 1 ])] = tostring(args.vars[tonumber(subpart[ 1 ])]) else @@ -1292,7 +1292,7 @@ pattern = 'CHANNEL = love.thread.getChannel("save_request")' position = 'after' payload = ''' function tal_compress_and_save(_file, _data, talisman) - local save_string = type(_data) == 'table' and STR_PACK(_data) or _data + local save_string = is_big(_data) and STR_PACK(_data) or _data local fallback_save = STR_PACK({GAME = {won = true}}) --just bare minimum to not crash, maybe eventually display some info? if talisman == 'bignumber' then fallback_save = "if not BigMeta then " .. fallback_save @@ -1429,7 +1429,7 @@ target = 'engine/sprite.lua' pattern = "G.SHADERS[_shader]:send(v.name, v.val or (v.func and v.func()) or v.ref_table[v.ref_value])" position = 'at' payload = '''local val = v.val or (v.func and v.func()) or v.ref_table[v.ref_value] -if type(val) == "table" and is_number(val) then +if is_big(val) and is_number(val) then if val > to_big(1e300) then val = 1e300 else diff --git a/talisman.lua b/talisman.lua index 2720c9e..a754e05 100644 --- a/talisman.lua +++ b/talisman.lua @@ -143,7 +143,7 @@ if Talisman.config_file.break_infinity then local nf = number_format function number_format(num, e_switch_point) - if type(num) == 'table' then + if is_big(num) then --num = to_big(num) if num.str then return num.str end if num:arraySize() > 2 then @@ -162,12 +162,12 @@ if Talisman.config_file.break_infinity then local mf = math.floor function math.floor(x) - if type(x) == 'table' then return x.floor and x:floor() or x end + if is_big(x) then return x.floor and x:floor() or x end return mf(x) end local mc = math.ceil function math.ceil(x) - if type(x) == 'table' then return x:ceil() end + if is_big(x) then return x:ceil() end return mc(x) end @@ -183,7 +183,7 @@ function lenient_bignum(x) local sns = score_number_scale function score_number_scale(scale, amt) local ret = sns(scale, amt) - if type(ret) == "table" then + if is_big(ret) then if ret > to_big(1e300) then return 1e300 end return ret:to_number() end @@ -192,7 +192,7 @@ function lenient_bignum(x) local gftsj = G.FUNCS.text_super_juice function G.FUNCS.text_super_juice(e, _amount) - if type(_amount) == "table" then + if is_big(_amount) then if _amount > to_big(1e300) then _amount = 1e300 else @@ -204,7 +204,7 @@ function lenient_bignum(x) local l10 = math.log10 function math.log10(x) - if type(x) == 'table' then + if is_big(x) then if x.log10 then return lenient_bignum(x:log10()) end return lenient_bignum(l10(math.min(x:to_number(),1e300))) end @@ -214,7 +214,7 @@ function lenient_bignum(x) local lg = math.log function math.log(x, y) if not y then y = 2.718281828459045 end - if type(x) == 'table' then + if is_big(x) then if x.log then return lenient_bignum(x:log(to_big(y))) end if x.logBase then return lenient_bignum(x:logBase(to_big(y))) end return lenient_bignum(lg(math.min(x:to_number(),1e300),y)) @@ -387,7 +387,7 @@ function lenient_bignum(x) local tsj = G.FUNCS.text_super_juice function G.FUNCS.text_super_juice(e, _amount) - if type(_amount) == 'table' then + if is_big(_amount) then if _amount > to_big(2) then _amount = 2 end else if _amount > 2 then _amount = 2 end @@ -398,7 +398,7 @@ function lenient_bignum(x) local max = math.max --don't return a Big unless we have to - it causes nativefs to break function math.max(x, y) - if type(x) == 'table' or type(y) == 'table' then + if is_big(x) or is_big(y) then x = to_big(x) y = to_big(y) if (x > y) then @@ -411,7 +411,7 @@ function lenient_bignum(x) local min = math.min function math.min(x, y) - if type(x) == 'table' or type(y) == 'table' then + if is_big(x) or is_big(y) then x = to_big(x) y = to_big(y) if (x < y) then @@ -424,7 +424,7 @@ function lenient_bignum(x) local sqrt = math.sqrt function math.sqrt(x) - if type(x) == 'table' then + if is_big(x) then if getmetatable(x) == BigMeta then return x:sqrt() end if getmetatable(x) == OmegaMeta then return x:pow(0.5) end end @@ -435,7 +435,7 @@ function lenient_bignum(x) local old_abs = math.abs function math.abs(x) - if type(x) == 'table' then + if is_big(x) then x = to_big(x) if (x < to_big(0)) then return -1 * x @@ -447,7 +447,7 @@ function lenient_bignum(x) end function is_big(x) - return type(x) == 'table' and ((x.e and x.m) or (x.array and x.sign)) + return is_big(x) and ((x.e and x.m) or (x.array and x.sign)) end function is_number(x) @@ -480,7 +480,7 @@ function to_big(x, y) end end function to_number(x) - if type(x) == 'table' and (getmetatable(x) == BigMeta or getmetatable(x) == OmegaMeta) then + if is_big(x) and (getmetatable(x) == BigMeta or getmetatable(x) == OmegaMeta) then return x:to_number() else return x From 7c22f81cb65a9856a4aefc386611a0eb2183e334 Mon Sep 17 00:00:00 2001 From: frostice482 Date: Thu, 30 Oct 2025 21:13:57 +0700 Subject: [PATCH 3/5] fix (1) --- lovely.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lovely.toml b/lovely.toml index 35db0fc..0b1e331 100644 --- a/lovely.toml +++ b/lovely.toml @@ -801,7 +801,7 @@ if eee_chips > 0 then end local hyper_chips = card:get_chip_hyper_bonus() -if is_big(hyper_chips) and hyper_chips[1] > 0 and hyper_chips[2] > 0 then +if type(hyper_chips) == 'table' and hyper_chips[1] > 0 and hyper_chips[2] > 0 then ret.hyper_chips = hyper_chips end @@ -821,7 +821,7 @@ if eee_mult > 0 then end local hyper_mult = card:get_chip_hyper_mult() -if is_big(hyper_mult) and hyper_mult[1] > 0 and hyper_mult[2] > 0 then +if type(hyper_mult) == 'table' and hyper_mult[1] > 0 and hyper_mult[2] > 0 then ret.hyper_mult = hyper_mult end ''' @@ -1292,7 +1292,7 @@ pattern = 'CHANNEL = love.thread.getChannel("save_request")' position = 'after' payload = ''' function tal_compress_and_save(_file, _data, talisman) - local save_string = is_big(_data) and STR_PACK(_data) or _data + local save_string = type(_data) == 'table' and STR_PACK(_data) or _data local fallback_save = STR_PACK({GAME = {won = true}}) --just bare minimum to not crash, maybe eventually display some info? if talisman == 'bignumber' then fallback_save = "if not BigMeta then " .. fallback_save From 97733cdd24885ab531f8e7e43b05d8ce4b959843 Mon Sep 17 00:00:00 2001 From: frostice482 Date: Thu, 30 Oct 2025 21:17:23 +0700 Subject: [PATCH 4/5] change table checks (2) --- lovely.toml | 10 +++++----- talisman.lua | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lovely.toml b/lovely.toml index 0b1e331..fe0964b 100644 --- a/lovely.toml +++ b/lovely.toml @@ -329,10 +329,10 @@ position = "before" line_prepend = "$indent" payload = ''' if Big then - if type(self.strings[k].W) == 'table' then + if is_big(self.strings[k].W) then self.strings[k].W = to_number(self.strings[k].W) end - if type(self.strings[k].H) == 'table' then + if is_big(self.strings[k].H) then self.strings[k].H = to_number(self.strings[k].H) end end @@ -1446,14 +1446,14 @@ target = 'functions/misc_functions.lua' pattern = "AC[k].vol = (not G.video_organ and G.STATE == G.STATES.SPLASH) and 0 or AC[k].vol and v.volfunc(AC[k].vol) or 0" position = 'after' payload = ''' -if type(AC[k].vol) == "table" then +if is_big(AC[k].vol) then if AC[k].vol > to_big(1e300) then AC[k].vol = 1e300 else AC[k].vol = to_number(AC[k].vol) end end -if type(AC[k].per) == "table" then +if is_big(AC[k].per) then if AC[k].per > to_big(1e300) then AC[k].per = 1e300 else @@ -1468,7 +1468,7 @@ match_indent = true target = 'functions/button_callbacks.lua' pattern = "_F.intensity = ((G.pack_cards and not G.pack_cards.REMOVED) or (G.TAROT_INTERRUPT)) and 0 or math.max(0., math.log(G.ARGS.score_intensity.earned_score, 5)-2)" position = 'after' -payload = '''if type(_F.intensity) == "table" then +payload = '''if is_big(_F.intensity) then if _F.intensity > to_big(1e300) then _F.intensity = 1e300 else diff --git a/talisman.lua b/talisman.lua index a754e05..ff97c4f 100644 --- a/talisman.lua +++ b/talisman.lua @@ -341,7 +341,7 @@ function lenient_bignum(x) if not G.PROFILES[G.SETTINGS.profile].career_stats[stat] then G.PROFILES[G.SETTINGS.profile].career_stats[stat] = 0 end G.PROFILES[G.SETTINGS.profile].career_stats[stat] = G.PROFILES[G.SETTINGS.profile].career_stats[stat] + (mod or 0) -- Make sure this isn't ever a talisman number - if type(G.PROFILES[G.SETTINGS.profile].career_stats[stat]) == 'table' then + if is_big(G.PROFILES[G.SETTINGS.profile].career_stats[stat]) then if G.PROFILES[G.SETTINGS.profile].career_stats[stat] > to_big(1e300) then G.PROFILES[G.SETTINGS.profile].career_stats[stat] = to_big(1e300) elseif G.PROFILES[G.SETTINGS.profile].career_stats[stat] < to_big(-1e300) then From 092c0ff72aaae354430f92d5e046c584f2a2bf63 Mon Sep 17 00:00:00 2001 From: frostice482 Date: Fri, 31 Oct 2025 02:01:40 +0700 Subject: [PATCH 5/5] fix --- talisman.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/talisman.lua b/talisman.lua index ff97c4f..0dd291d 100644 --- a/talisman.lua +++ b/talisman.lua @@ -122,6 +122,15 @@ G.FUNCS.talisman_upd_score_opt = function(e) Talisman.config_file.break_infinity = score_opts[e.to_key] nativefs.write(talisman_path .. "/config.lua", STR_PACK(Talisman.config_file)) end + +function is_big(x) + return type(x) == "table" and ((x.e and x.m) or (x.array and x.sign)) +end + +function is_number(x) + return type(x) == 'number' or is_big(x) +end + if Talisman.config_file.break_infinity then Big, err = nativefs.load(talisman_path.."/big-num/"..Talisman.config_file.break_infinity..".lua") if not err then Big = Big() else Big = nil end @@ -446,14 +455,6 @@ function lenient_bignum(x) end end -function is_big(x) - return is_big(x) and ((x.e and x.m) or (x.array and x.sign)) -end - -function is_number(x) - return type(x) == 'number' or is_big(x) -end - function to_big(x, y) if type(x) == 'string' and x == "0" then --hack for when 0 is asked to be a bignumber need to really figure out the fix return 0