LDB implementation questions
Ok, I think I've got it right, but I thought I'd just a couple of questions.
1. In the data feed example here there is the line; Code:
f:SetScript("OnUpdate", function(self, elap) 2. In the line; Code:
dataobj.text = string.format("%.1f FPS", fps) Thanks in advance. |
First one . . . you need to know when OnUpdate fires in relation to what? Last call? Script start? real time?
as for the second part of your post yes that's what it does . . . returns a compacted float to that decimal. See the examples here: http://www.wowwiki.com/API_format |
When OnUpdate fires in relation to Script start, and after each sucessive call.
The idea I got from looking at the code was that it was called quite often, and the function dealt with the actual string updating, but upon closer inspection it seems I can set the actual updates to fire when the string updates with the code Code:
local ldb = LibStub:GetLibrary("LibDataBroker-1.1") |
I think you are misunderstanding. That OnUpdate is just a normal frame's OnUpdate and it's being used as a timer. Don't want to update the LDB display every OnUpdate as that's QUITE often and will certainly slowdown the client for such a simple amount of code. Basically that code runs every "frame" where frame is probably not quite as often as a screen redraw but quite quick nontheless.
Code:
elapsed = elapsed + elap It will probably help if I know what kind of LDB plugin you are attempting to make? |
Quote:
|
ok since I'm going to bed . . . if you just wish to update the text the command:
Code:
dataobj.text = string.format("%.1f FPS", fps) Good luck I'll check this after I wake my rear end up. |
Quote:
Just read your newer post. So, I'd just add in a new line to my OnEvent code that updates the dataobj.text var whenever it needs to be updated. So my final code (for updating the feed) would end up being something like. Code:
-- Called at OnEvent I'll try it out in a little while, and tell you if it works. |
That looks right to me. Good luck.
|
A little bit of tinkering managed to get me a working feed. :banana:
I'll probibly write a 'How To' sometime in the next couple of days, because this is still not crystal clear to me, and if I replicate it a few times, I'll probibly get the theory behind it into my head. Thanks again. ...Sel. |
Quote:
|
All times are GMT -6. The time now is 08:05 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI