So I've been trying to create a screen that switches between multiple different images, almost identically to the home screen of Five Nights at Freddy's 1. My issue has been timers and delays, trying to get functions to execute after a set amount of time. I've seen a lot of people suggest using the Cron or Tick libraries, but when I set them up and try to run the program, I get this error every time;
Error
main.lua:5: attempt to index local 'cron' (a boolean value)
Traceback
[love "callbacks.lua"]:228: in function 'handler'
main.lua:5: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
this is the line it is referencing;
cron.update(dt)
i believe i've set everything up correctly, i have the cron.lua file in my main game folder, and the first line in my main.lua file is;
local cron = require 'cron'
i've tried getting rid of the "local" part, no difference is made. i hope i'm just being dumb, could someone please help me out? i've been going crazy over the course of the last hour trying to solve this.
No libraries are working for me :/
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: No libraries are working for me :/
Does cron.lua return a table? When you require() a module and the module file doesn't return anything then the default value returned from require() is 'true'. Maybe Cron adds globals that you're expected to use instead of the returned value from require().
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Re: No libraries are working for me :/
attached are the cron installation instructions, which i think i followed, but maybe i misunderstood something in them. this is all that's listed for installing/making cron work.ReFreezed wrote: ↑Wed Aug 24, 2022 3:34 pm Does cron.lua return a table? When you require() a module and the module file doesn't return anything then the default value returned from require() is 'true'. Maybe Cron adds globals that you're expected to use instead of the returned value from require().
- 1414codeforge
- Prole
- Posts: 16
- Joined: Fri Aug 05, 2022 1:14 pm
- Location: Italy, Sardinia
- Contact:
Re: No libraries are working for me :/
Could you attach the main.lua, so we can check the code out in its entirety?
Also, you mean this cron.lua library?
https://github.com/kikito/cron.lua
Also, you mean this cron.lua library?
https://github.com/kikito/cron.lua
Re: No libraries are working for me :/
There must be a name collision. Don't use the 'cron' variable for the created timer objects. Look at the examples again.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Who is online
Users browsing this forum: Google [Bot] and 4 guests