New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong info in docs on OP_TEST and OP_TESTSET #184
Comments
|
Thank you @Kristopher38 appreciate the feedback. I will check and correct. |
|
Hi @Kristopher38, strange as the comment in lopcodes.h must be wrong then? |
|
Hi @Kristopher38 Please would you review https://github.com/dibyendumajumdar/ravi/blob/master/readthedocs/lua_bytecode_reference.rst? I am still working through the various examples of bytecode |
|
Hi, I've read through the commits and they look correct to me. The updated bytecode explanations will especially help at getting a better grasp of what exactly is the execution flow of those opcodes. Also thanks for creating this reference manual and keeping it up to date :) |
|
@Kristopher38 Thank you for reporting the issue and also for reviewing the changes. Really appreciated. |
This issue is regarding Lua bytecode reference docs. In the section on OP_TEST and OP_TESTSET there is a line that states:
And a pseudocode:
But closely reading the Lua source for version 5.3.5, where the handling of OP_TEST and OP_TESTSET happens, we can conclude that the info in the docs is the wrong way around. Let me explain that with OP_TESTSET (the same applies to OP_TEST as well, just without R(A) = R(B) and the argument slots are different as stated in the docs). In the lvm.c the code for handling OP_TESTSET is as follows:
Now let me rewrite that in pseudocode (value in R(B) is coerced into a Lua boolean):
Which essentially means:
But the docs clearly state the opposite:
Paragraphs on OP_TEST and OP_TESTSET should be corrected to not be misleading.
The text was updated successfully, but these errors were encountered: