I have been having trouble trying to figure out the original code for part of this lua file. It contains a "pseudo-goto" to reproduce what seems to be something that can't quite be compiled by normal means. Unluac gives the following output:
if bCounterRunning then
repeat
break -- pseudo-goto
until true
if bSkipClose then
gGordBlip = AddBlipForChar(gord, 5, 0, 5)
gLolaBlip = AddBlipForChar(lola, 4, 0, 5)
bCounterRunning = false
TextPrint("3_01_OALLEY", 4, 1)
end
end
The prolem is, compiling again gives a completely different result.
There are 2 jmp instructions back-to-back, which wouldn't be a problem if this was not lua5.0.2 and there was support for goto.
I have searched other topics here related to "pseudo-goto" and even tried to recreate some code I found but nothing seems to get the same bytecode. I just can't figure this out.
I included the problematic file in attachments and was hoping to find some help if possible. Thank you!
Non-branching conditional is another way of getting a naked jump, probably more common that repeat break. Unluac knows about it and will generate it sometimes, but I think actually it isn't considered for conditional combining which would be the only way for it to end up in an 'or' expression. It might be a pain since unluac's current order of operations would make this a reverse-dependency -- combined branches are used to contextualize the more complicated and subtle unconditional jumps (else/break/goto). I'll be thinking about it, but don't expect quick turnaround for a fix.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's just weird why anyone would write code like this, not really something one would see everyday so it can be challenging to figure out. There is no problem at all, I just couldn't figure this one out. But now it's done. Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been having trouble trying to figure out the original code for part of this lua file. It contains a "pseudo-goto" to reproduce what seems to be something that can't quite be compiled by normal means.
Unluac gives the following output:
The prolem is, compiling again gives a completely different result.
This is the disassemble for the original chunk:
There are 2 jmp instructions back-to-back, which wouldn't be a problem if this was not lua5.0.2 and there was support for goto.
I have searched other topics here related to "pseudo-goto" and even tried to recreate some code I found but nothing seems to get the same bytecode. I just can't figure this out.
I included the problematic file in attachments and was hoping to find some help if possible. Thank you!
I think it should be
Let me know if you think that doesn't match.
Non-branching conditional is another way of getting a naked jump, probably more common that repeat break. Unluac knows about it and will generate it sometimes, but I think actually it isn't considered for conditional combining which would be the only way for it to end up in an 'or' expression. It might be a pain since unluac's current order of operations would make this a reverse-dependency -- combined branches are used to contextualize the more complicated and subtle unconditional jumps (else/break/goto). I'll be thinking about it, but don't expect quick turnaround for a fix.
That was it!
It's just weird why anyone would write code like this, not really something one would see everyday so it can be challenging to figure out. There is no problem at all, I just couldn't figure this one out. But now it's done. Thank you!