View Single Post
04/23/14, 05:46 PM   #5
Joviex
 
Joviex's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 42
Originally Posted by zireko View Post
I simply want to ask how I would get the frame rate to display in a small window? I currently have this small lua and I'm just trying to call a function. This is my first thing and I'm trying to play around with a very very simple addon. My lua code is listed below.

Lua Code:
  1. function GetFramerate(number)
  2. end

This is the only line of code I currently have and I'm not getting any lua error or anything. But it is not displaying anywhere. Do I need to make a frame for it to display in? If so how would I do that easy methods only please.
The code above wont do anything because all you are doing is defining a new function called GetFramerate(paramter = number)


What you want to do is "CALL" the function GetFramerate, not re-define it.


e.g.


fps = GetFramerate()
d(fps)


will display the framerate in the console.


For "constant" updating you would need to hook a callback, so, periodically it would call whatever function you want to perform some action, like, getting the framerate every 100 milliseconds, etc...


If you want to display it on more than the console output, yes, you would need to make a "frame" for it.
  Reply With Quote