Skip to content

SubLevelAPI functions are not on the main thread #6

@lucaargolo

Description

@lucaargolo

Every once in a while my ships were being randomly teleported to 0 0 0, turns out it was being caused by CC-Sable. The problem is that your Lua Functions are being executed in the CC Thread instead of the Server Thread, and that does some weird things to Sable.

You can reproduce this error by having a computer in a sub level doing the following:

while true do
    print(sublevel.getLogicalPose())
    sleep(0.05)
end

And then just fly around your world.

It might take a while, but a good way I found it to force it to happen is just setting the /tick rate to something big like 10000 and then throwing the ship around using the creative physics wand thingy.

You can fix it by setting the @LuaFunction annotations to @LuaFunction(mainThread = true)
Tested it on a local build and it seems to work well

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions