Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Lua timer helper - uTimer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
WhiteSnoop
How do I cheat?
Reputation: 1

Joined: 15 May 2009
Posts: 7
Location: http://alino.ucoz.com

PostPosted: Sat Jan 29, 2022 1:01 pm    Post subject: Lua timer helper - uTimer This post has 1 review(s) Reply with quote

I am a strong ``local`` user. Whenever defining variables I don't want to keep around (or add to the global table, who knows what we're overwriting!)
However, when you would do: local someVar = createTimer()
Eventually the local "someVar" would not be available anymore (especially during testing in the Lua Engine window) So you would end up with creating another timer everytime you hit execute.
I created this library to do that for us. The most important key for me was to keep all timers in a table so I was able to track them. Or to purge all timers.

I wrote this little library for myself, but figured it might be of some use for others. Feel free to suggest or update the lib to your liking

Code:
uTimer            
      methods
         update(1:string name, 2:table table) ---- can also call uTimer() instead, figured I'd be using this the most
            will make a new timer if it doesn't exist, kinda making ''make()'' useless
            the table requires parametersnames to be what the timer object expects
              Enabled,
              OnTimer,
              Interval
              etc...
             
              Create Example:
                 uTimer.update("SomeTimer", {
                  Enabled = true, -- don't need to supply on creation, but better safe than insanity right?
                  OnTimer = function()
                     print("Hello uTimer!")
                  end,
                  Interval = 1000
                 })
                
              Update Function Example:
                 uTimer.update("SomeTimer", {OnTimer = function() print("No more, mr Hello uTimer!") end})
                
              Disable Example:
                 uTimer.update("SomeTimer", {Enabled = false})
             
                
         make(1:string name, 2:function func, 3:number interval, 4:boolean disabled)
            makes a new timer object and stores it in the uTimer.Table to be accessed. Allows to make a simple timer object
            
            returns timerObject
            
         purge(1:string name)
            purges (destroys) the given timer in the uTimer.Table
            
         purgeAll()
            purges (destroys) all the timers in the uTimer.Table
            
         listActive()
            primitively prints active timers to the Lua Engine window
            
         Table
            is used to store all timers that are created through this lib
            can read manually from like (uTimer.Table["SomeTimer"] or uTimer.Table.SomeTimer)
            will return the timer object



uTimer.lua
 Description:

Download
 Filename:  uTimer.lua
 Filesize:  3.69 KB
 Downloaded:  590 Time(s)

Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites