attempt to call global 'require'

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
Klobo
Prole
Posts: 4
Joined: Wed Dec 09, 2015 6:38 pm

attempt to call global 'require'

Post 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!
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: attempt to call global 'require'

Post 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?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: attempt to call global 'require'

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

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Klobo
Prole
Posts: 4
Joined: Wed Dec 09, 2015 6:38 pm

Re: attempt to call global 'require'

Post by Klobo »

Solved. It was a loop of require between 3 files..

The post can be closed.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: attempt to call global 'require'

Post by zorg »

You tag your own opening post as [SOLVED] then.
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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], EvolvedAnt, Google [Bot] and 8 guests