From 3085628ad505a930d2b542bd65941f2b62b979ae Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 28 Dec 2009 00:19:19 +0100 Subject: Completing a bit the struct display. --- dalos-struct.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/dalos-struct.lua b/dalos-struct.lua index d3e0080..189c3be 100644 --- a/dalos-struct.lua +++ b/dalos-struct.lua @@ -74,18 +74,21 @@ dalosp.struct = { local v if t == "int8" then - v = h:readU8() - return v > 127 and v - 256 or v + return h:read8() elseif t == "uint8" then return h:readU8() elseif t == "int16" then + return h:read16() elseif t == "uint16" then return h:readU16() elseif t == "int32" then + return h:read32() elseif t == "uint32" then return h:readU32() elseif t == "int64" then + return h:read64() elseif t == "uint64" then + return h:readU64() elseif t == "float" then return h:readFloat() elseif t == "double" then @@ -99,11 +102,7 @@ dalosp.struct = { until b == 0 return v elseif t == "nascii" then - v = "" - for i = 1, size do - v = v .. string.char(h:readU8()) - end - return v + return h:readstring(size) end return 0 @@ -387,7 +386,7 @@ dalosp.struct = { end, act_value_cb = function (self, lin, col) - if lin == 0 then if col == 1 then return "Field" elseif col == 2 return "Value" end end + if lin == 0 then if col == 1 then return "Field" elseif col == 2 then return "Value" end end if col == 0 then return nil end local entry = self.struct.extra.entries[lin] -- cgit v1.2.3