Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# lua-simulation-libraries

Lua libraries to be used in CarSimulator simulation scripts.

## Supported functions

### hex.lua

- hexToAscii (convert string from hex to ASCII)
- asciiToHex (convert string from ASCII to hex)
14 changes: 14 additions & 0 deletions hex.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--[[
Convert the given number to hexadecimal notation
]]
function numberToHex(num)
return string.format('%x', num)
end

--[[
Convert the given ASCII string to hexadecimal notation
]]
function asciiToHex(str)
return (str:gsub(".", function(char) return string.format("%2x", char:byte()) end))
end

4 changes: 0 additions & 4 deletions lualib.lua

This file was deleted.