lbi icon indicating copy to clipboard operation
lbi copied to clipboard

Inconsistency with actual lua (stack issue)

Open taikonaut001 opened this issue 3 years ago • 1 comments

This repository hasn't been touched in ages but it is still useful so I would like to point something out to those who use it. The program:

local functions = {}
for i = 1, 10 do
    functions[i] = function()
        print(i)
    end
end
functions[2]()
functions[9]()

real lua output:

2
9

lbi output:

10
10

I'm having trouble describing the problem with words so I hope the above example was enough for you to understand.

I would create a pull request if I knew how to fix this but the easiest work around for me was to use https://github.com/Rerumu/FiOne instead.

taikonaut001 avatar Mar 20 '22 09:03 taikonaut001

Thanks for the bug report.

I think it might be this code lol

		[35] = function(instruction)	-- CLOSE
			io.stderr:write("NYI: CLOSE")
			io.stderr:flush()
		end,

But yea, looks like a pretty big problem with closures. I will try to fix this sometime in the next few days.

JustAPerson avatar Apr 06 '22 01:04 JustAPerson