Page 1 of 2

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

Posted: Tue Apr 30, 2019 4:02 pm
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'

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

Posted: Sat May 04, 2019 10:22 pm
by DjSapsan
any answer???

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

Posted: Sat May 04, 2019 11:16 pm
by zorg
Welcome to the forums.
It's slower than Discord.
Be patient.

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

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

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

Posted: Thu May 09, 2019 10:03 pm
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)

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

Posted: Fri May 10, 2019 2:12 am
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?

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

Posted: Fri May 10, 2019 6:40 pm
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

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

Posted: Fri May 10, 2019 6:52 pm
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.

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

Posted: Fri May 10, 2019 7:08 pm
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.

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

Posted: Sat May 11, 2019 6:15 pm
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...