Skip to content

Documentation#2

Open
imhotep82 wants to merge 3 commits intoAVL-DiTEST-DiagDev:developfrom
imhotep82:documentation
Open

Documentation#2
imhotep82 wants to merge 3 commits intoAVL-DiTEST-DiagDev:developfrom
imhotep82:documentation

Conversation

@imhotep82
Copy link
Copy Markdown

No description provided.

@tjaehnel
Copy link
Copy Markdown
Contributor

tjaehnel commented Jul 8, 2021

These two additional functions are nice.
But the toHex() function that was there has been removed without any replacement.

@imhotep82
Copy link
Copy Markdown
Author

imhotep82 commented Jul 9, 2021

These two additional functions are nice.
But the toHex() function that was there has been removed without any replacement.

numberToHex does the same thing. Could we write some tests to verify the functionality?

See here: https://leafo.net/guides/testing-lua-modules-with-github-actions.html

@tjaehnel
Copy link
Copy Markdown
Contributor

tjaehnel commented Jul 9, 2021

numberToHex has only one parameter, I can't pass a length to it, so it can't do the same thing.
Also I like to have the name as short as possible because you need it all the time.

@imhotep82
Copy link
Copy Markdown
Author

numberToHex has only one parameter, I can't pass a length to it, so it can't do the same thing.
Also I like to have the name as short as possible because you need it all the time.

Is this used for padding the values with zeros? The new function just converts the value to a HEX notation.

@lnzspraj
Copy link
Copy Markdown
Contributor

You could turn the length argument into an optional argument:

function numberToHex(num, bytes)
	return string.format('%' .. (bytes and '0' .. bytes * 2 or '') .. 'X', num)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants