No libraries are working for me :/

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
komega
Prole
Posts: 2
Joined: Wed Aug 24, 2022 3:08 pm

No libraries are working for me :/

Post by komega »

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.
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: No libraries are working for me :/

Post by ReFreezed »

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."
komega
Prole
Posts: 2
Joined: Wed Aug 24, 2022 3:08 pm

Re: No libraries are working for me :/

Post by komega »

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().
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.
Attachments
Screen Shot 2022-08-24 at 11.45.56 AM.png
Screen Shot 2022-08-24 at 11.45.56 AM.png (280.59 KiB) Viewed 2819 times
User avatar
1414codeforge
Prole
Posts: 16
Joined: Fri Aug 05, 2022 1:14 pm
Location: Italy, Sardinia
Contact:

Re: No libraries are working for me :/

Post by 1414codeforge »

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
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: No libraries are working for me :/

Post by ReFreezed »

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."
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests