mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-11-05 09:36:19 +00:00
e7fe22d4f8
I've been meaning to fix this for over 6 years, and just kept forgetting. Previously ILuaContext.executeMainThreadTask worked by running ILuaContext.issueMainThreadTask, pulling task_complete events, and then returning the results. While this makes the implementation simple, it means that the task's results were converted into Lua values (in order to queue the event) and then back into Java ones (when the event was pulled), before eventually being converted into Lua once more. Not only is this inefficient, as roundtripping isn't lossless, you couldn't return functions or rich objects from main thread functions (see https://github.com/dan200/ComputerCraft/issues/125). We now store the return value on the Java side and then return that when the receiving the task_complete event - the event no longer carries the result. Note this does not affect methods using issueMainThreadTask! |
||
---|---|---|
.. | ||
src | ||
build.gradle.kts |