Error: attempt to index field 'physics' (a nil value)

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
arikel2
Prole
Posts: 6
Joined: Tue Dec 03, 2013 11:51 am

Error: attempt to index field 'physics' (a nil value)

Post by arikel2 »

I have love 11.5 installed, everything is working fine, except that it doesn't seem to have a "physics" module. Did I miss something?
User avatar
marclurr
Party member
Posts: 157
Joined: Fri Apr 22, 2022 9:25 am

Re: Error: attempt to index field 'physics' (a nil value)

Post by marclurr »

It should be love.physics
arikel2
Prole
Posts: 6
Joined: Tue Dec 03, 2013 11:51 am

Re: Error: attempt to index field 'physics' (a nil value)

Post by arikel2 »

It should be love.physics, yes, it should, I have read the docs.
But when I try to access it, love doesn't find a "physics" field.

Simplest possible "main.lua" file :
print(love.graphics)
print(love.physics)

that gets me :
table: 0x40922bc0
nil

Now, curiously (just found that), when I add "love.physics = require("love.physics")", suddenly everything works.
I'm just curious, did I fuck up my love2D installation somehow? Why would any other module in love be readily available, but not the physics one? Or is it just some weird thing that is happening just to me (because, after some googling, I found no one having this problem)?
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Error: attempt to index field 'physics' (a nil value)

Post by slime »

It sounds like you've disabled love.physics in your conf.lua file.
arikel2
Prole
Posts: 6
Joined: Tue Dec 03, 2013 11:51 am

Re: Error: attempt to index field 'physics' (a nil value)

Post by arikel2 »

Wow, thanks! That was exactly it! Damn, what a moron I am. I have no idea why I even put that in my conf file, I suppose I thought it could lighten the memory taken (like it would matter so much nowadays), but no way it could improve the performance anyway.
Post Reply

Who is online

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