Skip to content

ProgramCore

Thomas2889 edited this page Aug 15, 2021 · 1 revision

Quick Setup:

local Core = require("ProgramCore")

-- This will attempt to run the loop 1 time per second
Core.targetTPS = 1


local function Main()
    -- Print the delta every loop (should be something equal to 1, as delta is measured in seconds)
    print(Core.delta)
    
    -- Note TestForExitCondition isn't part of the library. This is just to show off your program
    -- testing for an exit condition
    if TestForExitCondition() then
        Core.running = false
    end
end


-- Run the main program loop. Will stop once Core.running is set to false
Core.Run(Main)

All Functions and Variables:

  • Run(callback) Will run the main loop and call the callback every time
  • targetTPS This is the target ticks per second of the program.
  • running This is the running status of the program. It is set to true when Run() is called. Once set to false the loop will exit.
  • delta This is updated before the callback is called every loop and is the number of seconds since the last loop.

Clone this wiki locally