View previous topic :: View next topic |
Author |
Message |
hemersonkla1 Cheater Reputation: 0
Joined: 24 Jun 2015 Posts: 34
|
Posted: Sun Sep 17, 2017 1:18 pm Post subject: doubleToByteTable format help |
|
|
Code: | local bt = doubleToByteTable(36)
for i, v in ipairs(bt) do
print(i - 1, string.format('%02X', v))
end |
out
0 00
1 00
2 00
3 00
4 00
5 00
6 42
7 40
Hello friends. I need your help again. I want to convert doubleToByteTable so that for example the number 36 is in that format
40 42 in hex it will originally convert 42 40 and with these line breaks I need it to stay like this = 40 42 forming an aob. Can you help me? Thank you.
Description: |
|
Filesize: |
11.22 KB |
Viewed: |
2383 Time(s) |
|
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Sep 17, 2017 1:54 pm Post subject: |
|
|
Code: | local bt = doubleToByteTable(36)
local str = string.format("(%02X %02X %02X %02X %02X %02X %02X %02X)",unpack(bt))
print(str) |
Code: | local bt = doubleToByteTable(36)
local str = "("
for i, v in ipairs(bt) do
if i > 1 then
str = str .. " "
end
str = str .. string.format("%02X", v)
end
str = str .. ")"
print(str) |
|
|
Back to top |
|
|
hemersonkla1 Cheater Reputation: 0
Joined: 24 Jun 2015 Posts: 34
|
Posted: Sun Sep 17, 2017 2:03 pm Post subject: |
|
|
Zanzer wrote: | Code: | local bt = doubleToByteTable(36)
local str = string.format("(%02X %02X %02X %02X %02X %02X %02X %02X)",unpack(bt))
print(str) |
Code: | local bt = doubleToByteTable(36)
local str = "("
for i, v in ipairs(bt) do
if i > 1 then
str = str .. " "
end
str = str .. string.format("%02X", v)
end
str = str .. ")"
print(str) |
|
Again. Thank you very much. That's what I wanted. Thanks for the help. =)
ps = as () was just to highlight. I will not use them =)
|
|
Back to top |
|
|
|