This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

perl pack equivalent in lua
#1
Hi,

I am trying to convert a perl script to lua and ran into the pack command.
Simplified, this is what's in the script:

Code:
#!/usr/bin/perl -l

$data = "00990102";
$checksum = 49;
    my $command = pack("H*","07F0" . $data . $checksum . "070F");
print $command;

This results in :
Code:
./test.pl |od -x --endian big
0000000 07f0 0099 0102 4907 0f0a

How can I achieve this in lua?
The perl script also uses the unpack command...

Thanks for your help.
Reply


Messages In This Thread
perl pack equivalent in lua - by baggins - 15.03.2021, 12:09
RE: perl pack equivalent in lua - by admin - 15.03.2021, 13:25
RE: perl pack equivalent in lua - by baggins - 15.03.2021, 14:21
RE: perl pack equivalent in lua - by baggins - 15.03.2021, 22:17

Forum Jump: