Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- repeater_lib.lua
- -- Define the delay in seconds for each repeater step
- local repeaterDelays = {
- [0] = 0.0, -- No Delay (0 ticks)
- [1] = 0.1, -- 1 Tick (1 tick)
- [2] = 0.2, -- 2 Ticks (2 ticks)
- [3] = 0.3, -- 3 Ticks (3 ticks)
- [4] = 0.4 -- 4 Ticks (4 ticks)
- }
- -- Function to get the sleep time based on repeater ticks
- -- Accepts the tick setting as an argument
- local function getSleepTime(ticks)
- -- Return the corresponding seconds or 0 if invalid
- return repeaterDelays[ticks] or 0.0
- end
- -- Public function to set the repeater delay
- local function repeaterSetting(tickSetting)
- local delayTime = getSleepTime(tickSetting)
- os.sleep(delayTime) -- Sleep for the duration of the repeater delay
- end
- -- Return the public API
- return {
- repeaterSetting = repeaterSetting
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement