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('