You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returning instances of ILuaObject from ILuaContext.executeMainThreadTask strips instances of ILuaObject. This is because the object is converted to a table of functions, which are converted then converted to null. I'm not sure this is easily fixable, I'm just documenting this issue in case others hit it.
To get around this I've been creating a "pointer" class, storing to it, and then returning its result in the parent method.
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 dan200/ComputerCraft#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!
Returning instances of
ILuaObject
fromILuaContext.executeMainThreadTask
strips instances ofILuaObject
. This is because the object is converted to a table of functions, which are converted then converted to null. I'm not sure this is easily fixable, I'm just documenting this issue in case others hit it.To get around this I've been creating a "pointer" class, storing to it, and then returning its result in the parent method.
Example
The text was updated successfully, but these errors were encountered: