Upvalues Overwritten

Causing any ‘Lua’ error (not from ROBLOX libraries or error functions) will overwrite every upvalue to some weird values. Usually numbers, threads and nil; depending on where the upvalue was indexed.

Reproduction code:

local x = "Hi"
coroutine.resume(coroutine.create(function()
	while wait() do
		print(x)
	end
end))
a()

Output:
> error: attempt to call global 'a' (a nil value)
> 367
> 367
> 367
> 367
...

This is not a new bug. I went through this problem 1 year ago but didn’t know the exact cause. So far I see no harm for this behavior and can be useful for ugly hacks. But still it shouldn’t be happening.

Note that it only occurs online and from a script (not from developer console).

I have to say, that looks like a really neat bug. Never ran into it myself, however.

I like to think I can rationalize how most bugs might happen, but this one… not really.

I’ll try and repro when I’m on my PC.

Just tested and apparently it resets the values to nil after 3-4 seconds. Very strange indeed.

This… apparently… is what happens when somebody decides to randomly call lua_settop(thread, 0) without considering the consequences. We’ll fix this.

1 Like

I think I bumped into this before but wasn’t able to get a good simple repro.

Good see it’s getting looked at.

I could be running into the same issue here, Not sure.

EDIT:

I indeed was running into the same issue :slight_smile:

This should be fixed now.