windfield/init.lua:36: attempt to call method 'collisionClear' (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.
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by DjSapsan »

Im using "windfield" library. Love2d version - latest 11.2
Line " world = wf.newWorld(0, 0, true) " gives me error from windfield itself. (edited to invalid line)

Code: Select all

Error

windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Traceback

windfield/init.lua:36: in function 'newWorld'
main.lua:11: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Last edited by DjSapsan on Thu May 09, 2019 10:04 pm, edited 1 time in total.
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by DjSapsan »

any answer???
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by zorg »

Welcome to the forums.
It's slower than Discord.
Be patient.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
4vZEROv
Party member
Posts: 126
Joined: Wed Jan 02, 2019 8:44 pm

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by 4vZEROv »

If you don't provide your code I can't help you.
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by DjSapsan »

4vZEROv wrote: Sun May 05, 2019 1:45 am If you don't provide your code I can't help you.

Code: Select all

world = wf.newWorld(0, 0, true)
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by pgimeno »

DjSapsan wrote: Thu May 09, 2019 10:03 pm

Code: Select all

world = wf.newWorld(0, 0, true)
When I try that, I get this error instead:

Code: Select all

Error: main.lua:1: attempt to index global 'wf' (a nil value)
stack traceback:
	[string "boot.lua"]:637: in function '__index'
	main.lua:1: in main chunk
	[C]: in function 'require'
	[string "boot.lua"]:475: in function <[string "boot.lua"]:311>
	[C]: in function 'xpcall'
	[string "boot.lua"]:645: in function <[string "boot.lua"]:639>
	[C]: in function 'xpcall'
which is expected because 'wf' is not defined, and I bet everyone who tries it will get the same error as me, therefore nobody can possibly figure out why you are getting a different error other than the expected one.

If that is not your whole code, can you show your whole code so we can understand which of the virtually infinite possibilities can be causing the problem?
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by DjSapsan »

I said "Im using "windfield" library". If you dont use it then you cant help me.
Its here: https://github.com/adnzzzzZ/windfield
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by pgimeno »

I tried this:

Code: Select all

local wf = require 'windfield'
world = wf.newWorld(0, 0, true)
No error.

It's not possible for anyone to help any further without seeing the code that leads to the situation that you're describing. If you don't want to provide it, you'll have to deal with it by yourself.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by zorg »

Looking at the source of it, it should work the way you called it... unless adn started to refactor it and didn't finish or something.

A shot in the dark: you put local wf = require whatever in love.load, and you're trying to call wf from elsewhere... but as pgimeno said, post more code.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
DjSapsan
Prole
Posts: 10
Joined: Tue Apr 30, 2019 3:57 pm

Re: windfield/init.lua:36: attempt to call method 'collisionClear' (a nil value)

Post by DjSapsan »

Well, idk how it works, but i fixed.
I had this line:

Code: Select all

 self.world:setCallbacks(beginContact, endContact, preSolve, postSolve)
That line was at few lines after original problem:

Code: Select all

self.world = wf.newWorld(0, 0, true)
Somehow Lua interpreted "setCallbacks" at the same time as creating new world. Last line that debugger has reach was creating world! I was not expected that line after error can cause problems O_o
I sounds stupid but i cant explain this...
Post Reply

Who is online

Users browsing this forum: No registered users and 206 guests