ThePhD / sol2

Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
http://sol2.rtfd.io/
MIT License
4.12k stars 500 forks source link

[sol2] An error occurred and panic has been invoked: stack index -1, expected string, received nil #1423

Open astrogames06 opened 1 year ago

astrogames06 commented 1 year ago

DISCLAIMER

I know this was already answered but I didn't understand it very well.

Guys, I'm getting this really weird error and I don't know where it's coming from. I wish sol could make their error messages more understandable.

Error

[sol2] An error occurred and panic has been invoked: stack index -1, expected string, received nil

Lua Code

print("Hello, world! lua loaded!")

TITLE = "HELLO, WORLD!"
WIDTH = 1000
HEIGHT = 600

r = 0

function update()
    background(BLACK)
    if keydown(KEY_E) then
        r = r + 0.1
    end
    rect(WIDTH/2, HEIGHT/2, 50, 50, 0, RED)
    rotate(r)
end

More info

I'm using C++17 with Visual studio on windows 11.

vdweller84 commented 1 year ago

Most likely, something is not defined in the code above.