Closed UltraEngine closed 9 months ago
If I try just printing out a class member, I get this error:
sol: runtime error: [string "C:\users\xxxxxxxxx\documents\ultra engine\projects\ultra project\source\main.lua"]:49: sol: 'self' argument is lua_nil (bad '.' access?)
This only occurs with the Bone class.
Son of a bitch, I did it again!: https://github.com/ThePhD/sol2/issues/1291#issuecomment-991288323
The Bone class was being declared to sol twice.
My Bone:SetRotation method works fine for several seconds, and then inexplicably reports a syntax error, as if it no longer recognizes the function parameters. I have tried creating a new Vec3 each frame, and I don't think that is the problem.
Full code here: https://www.ultraengine.com/learn/Entity_Attach?lang=lua
The variable "neck" is a shared pointer of the bone class: (std::shared_ptr<Bone>). The error seems to be occurring when the garbage collector is triggered. If I call collectgarbage() it happens right away, and if I call collectgarbage("stop") the error never occurs.
This is the error. It says it expected userdata but received Bone. I don't understand what this means? Both the bone and the Vec3 should be userdata values?
Here is the class binding code:
I'm using Lua 5.4.
Any idea what is wrong here?