From 559ea05287b02b2d6ab083fcd5cc5750d00a638e Mon Sep 17 00:00:00 2001 From: CPunch Date: Wed, 14 Aug 2019 15:47:18 -0500 Subject: [PATCH] fixed get_double --- luac.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/luac.py b/luac.py index cb054b3..02f3246 100644 --- a/luac.py +++ b/luac.py @@ -49,6 +49,10 @@ def get_bits(num, p, k): # convert extracted sub-string into decimal again return (int(kBitSubStr,2) % 256) +def get_bits_2(input, n): + pn = 2^(n-1) + return (input % (pn + pn) >= pn) and 1 or 0 + class LuaCompiler: def __init__(self): self.luac = "luac5.1" @@ -90,10 +94,13 @@ class LuaCompiler: self.index = self.index + self.size_t return s - def get_float(self): - f = struct.unpack('d', bytearray(self.bytecode[self.index:self.index+8])) + else: + f = struct.unpack('