Home > other >  My lua code compilation don't in the past, have a great god give me some directions, code and c
My lua code compilation don't in the past, have a great god give me some directions, code and c

Time:09-16

-- -- -- -- -- -- -- -- base64 -- -- -- -- -- -- -- -- -- --
The function str2hex (STR)
If (type (STR) ~="string") then
Return nil, "str2hex invalid input type", "
End
If (STR: len () % 2 ~=0) then
Return nil, "str2hex invalid input lenth"
End

The local index=1
The local ret=""
For the index=1, STR: len (), 2 do
Ret=ret... String. Char (tonumber (STR: sub (index, index + 1), 16))
End

Return ret
End

-- -- -- -- -- to compile results -- -- -- -- -- --
MQTT. Lua: 56: bad argument # 1 to 'char' (the number expected, got nil)
Stack traceback:
[C] : in the function of 'char'
MQTT. Lua: 56: in function 'str2hex'
MQTT. Lua: 65: in the main chunk
[C] : in function 'dofile'
Stdin: 1: the main in the chunk
  • Related