ComputerCraft

ComputerCraft

21M Downloads

[Suggestion] Expose queueEvent in ILuaContext

SquidDev opened this issue ยท 0 comments

commented

Expanding on this suggestion and this issue.

A previous CC version (1.70?) gave us ILuaContext.executeMainThreadTask and .issueMainThreadTask. This is really useful but sometimes you need to develop a more flexible task system (such as one which can delay a task by a number of ticks).

Normally I would use IComputerAccess.queueEvent. However this is problematic when dealing with objects generated with peripherals. A method may be invoked on this object but the peripheral is no longer attached, meaning queueEvent fails.

Currently it is possible to delay a task by running a task n times, however this is kinda ugly. By allowing ILuaContext to queue events such a system could be implemented more elegantly.