Page 1 of 1

attempt to call global 'require'

Posted: Mon Dec 21, 2015 12:11 am
by Klobo
Hi all, quick stupid question.

I've been programming happily and running the program normally and then suddenly I got this error (wich never happened before)

Code: Select all

Error: main.lua:2: attempt to call global 'require' (a string value)
stack traceback:
	main.lua:2: in main chunk
	[C]: in function 'require'
	[string "boot.lua"]:374: in function <[string "boot.lua"]:244>
	[C]: in function 'xpcall'
I checked for spelling errors but nothing.. I've never touched the line 2 of my code since its first implementation in my code

Here are my first lines of the code from main.lua

Code: Select all

require "airplane"
require "hump/vector"
require "load"
require "keyboard"
require "mouse"
require "camera"
require "mapmanager"
mdata = require("testmap")
airm = require("airmanager")
interface = require ("interface")
require "util"

function love.load()
	load.settings()
--..bla bla code continues
Strangely enough I get no error for the first line, despite the fact the syntax is the same and it always worked well

Any suggestions?

Thanks!

Re: attempt to call global 'require'

Posted: Mon Dec 21, 2015 12:15 am
by Nixola
The issue most probably lies in the file you require in the first line, airplane.lua (I guess) ; can you give us a .love file or at least the code in that file?

Re: attempt to call global 'require'

Posted: Mon Dec 21, 2015 12:40 am
by s-ol
in one of all those files you assign a value to "require", basically deleting the original function. There is something like

Code: Select all

require = "test"
somewhere.

Re: attempt to call global 'require'

Posted: Mon Dec 21, 2015 11:21 am
by Klobo
Solved. It was a loop of require between 3 files..

The post can be closed.

Re: attempt to call global 'require'

Posted: Mon Dec 21, 2015 2:24 pm
by zorg
You tag your own opening post as [SOLVED] then.