Skip to content
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

Weird lua issue with chobby #1819

Open
saurtron opened this issue Dec 14, 2024 · 0 comments
Open

Weird lua issue with chobby #1819

saurtron opened this issue Dec 14, 2024 · 0 comments

Comments

@saurtron
Copy link
Collaborator

Preface

I'm not sure what's going on here, but maybe together we can find out. Might be something stupid I'm overlooking, but I'll post here my findings.

Please excuse me if I'm misinterpreting something here very badly, but atm I'm baffled by the weird lua behaviour here.

The situation

There was a report from a player with the following error:

Error: in Chili lobby:layoutpanel185 : [string "libs/chiliui/chili/headers/util.lua"]:168: attempt to perform arithmetic on upvalue 'stackN' (a function value)

This doesn't seem smth that always happens, but just in some particular situations. In that specific report the user was complaining at discord (support-bugs > blackscreen in lobby) about a very bad blackscreen problem, he tried disconnecting some his extra monitors and that seemed to help.

The weird thing is, stackN there seems to be an integer in all situations:

./libs/chiliui/chili/headers/util.lua:local stackN = 1
./libs/chiliui/chili/headers/util.lua:  stackN = stackN + 1
./libs/chiliui/chili/headers/util.lua:  stackN = stackN - 1
./libs/chiliui/chili/headers/util.lua:  assert(stackN >= 1)
./libs/chiliui/chili/headers/util.lua:  if (stackN == 1) then

(that's all appearances of stackN in the chobby codebase)

Investigation

Can't say what's going on there, could be a bad error backtrace? investigating a bit, I found this document:

https://github.com/dlaurie/lua-notes/blob/master/upvalues.txt

This part of the text looks like it might be relevant, but it also could not be (and could actually be obsolete, or just not applicable here):

I.e., there is an upvalue `_ENV`, but it is not the first. Loading
`_ENV` into the first upvalue is worse than useless.

A good idiom for functions that will be saved and loaded as binary
chunks is therefore to put

    local _ENV = _ENV

Full traces:

spring-launcher-20241213T171109.log

some snippets with errors:

# this one is likely something else, but putting it here since it's also in the log
[2024-12-13 18:11:29.395] [info]  [t=00:00:16.558954][f=-000001] Download Handler Listener Error, [string "libs/chiliui/chili/controls/control.lua"]:1200: ActiveFBO(): OpenGL calls can only be used in Draw() call-ins, or while creating display lists, DownloadFinished
[2024-12-13 18:13:05.802] [warn]  [t=00:01:52.964739][f=-000001] [Chili] Error: in `Chili lobby`:layoutpanel185 : [string "libs/chiliui/chili/headers/util.lua"]:168: attempt to perform arithmetic on upvalue 'stackN' (a function value)
[2024-12-13 18:13:05.802] [warn]  [t=00:01:52.964887][f=-000001] [Chili] Error: stacktrace:
    [string "libs/chiliui/chili/headers/util.lua"]:168: in PopScissor
    [string "libs/chiliui/chili/headers/util.lua"]:258: in PopLimitRenderRegion
    [string "libs/chiliui/chili/controls/control.lua"]:1228: in _DrawInClientArea
    [string "libs/chiliui/chili/controls/control.lua"]:1273: in _DrawChildrenInClientArea
    ... (41 calls)
    [string "LuaHandler/handler.lua"]:981
    [string "libs/chiliui/chili/controls/object.lua"]:779: in fnc
[t=00:01:52.964899][f=-000001] [Chili] Error: In widget: Chili lobby
[t=00:01:52.964921][f=-000001] Error: DrawScreen: OpenGL stack check error, matrix mode = GL_MODELVIEW, depth = 14, please make sure to pop all matrices before 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

No branches or pull requests

1 participant