WoW LibFiber addon Dragonflight/Wrath of the Lich King Classic 2024
logo
wow addon LibFiber

LibFiber

Game Version: 6.1.0
Total Downloads: 908
Updated: Feb 28, 2015
Created: Feb 10, 2015
download LibFiberDownload Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
v2 release 4.02 KB Feb 28, 2015 6.1.0 706 download LibFiber v2 releaseDownload
v1 release 4.03 KB Feb 10, 2015 6.0.3 117 download LibFiber v1 releaseDownload
r4 alpha 4.20 KB Feb 28, 2015 6.1.0 45 download LibFiber r4 alphaDownload
r2 alpha 4.15 KB Feb 10, 2015 6.0.3 40 download LibFiber r2 alphaDownload

Screenshots

Description

Share this:

This library will help you to split big amount of calls that you can't control under combat lockdown to separate "fibers" in same frame to avoid "script ran too long" errors.

Available functions

Just one for the moment:

lib:WrapVoidMethod(object, method)

Given object and method name, this function will replace original method with a wrapper that
will either just call the original if you're out of combat or reschedule it to separate "fiber"
in same frame created through Blizzard's timer call that happen to have separate execution
time limit and thus helps to avoid "script ran too long" error caused by sheer amount of calls per frame.

This function is intended to wrap calls that are fast enough by themselves but that could be called
in amounts that you, as developer, can't control. For example: action or macro buttons if your addon
allows to create unlimited amount – even if one button update reliably takes, say, 2ms, user who
creates over 100 buttons will hit "script ran too long"; item slot buttons – their amount just naturally
increases as Blizzard introduces larger bags; etc.

Wrapped method must have no arguments or returns except implied "self" as they're silently dropped.
This generally fits the signature of :Update methods that read data from their instance.

DO try to optimize problematic function as much as possible – even if you wrap it, total time of calls
will still incur noticeable FPS hiccup and wrapper will also add some overhead to that.
DO separate multiple calls manually to different frames if your updates have some predictable pattern
and don't really need visual or whatever result instantly. For example updating texture, count or cooldown
on item slot should happen as soon as player opens bag window or relevant event happens, while drawing
highlight border for custom search can be split over several next frames and player won't even notice it.

Included EXAMPLE.lua file shows example of usage and allows you to test how it works.

Comments

Add a comment