Error- attempt to index field 'module' (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
brokenEye
Prole
Posts: 3
Joined: Fri Sep 25, 2015 1:17 am

Error- attempt to index field 'module' (a nil value)

Post by brokenEye »

Hello everyone! I'm very obviously new to Love and programming in general, so try not to be too offended as I get my bearings. :death:

Simply put I guess, when I try to run my project I'm getting an error
boot.lua:339 conf.lua:2: attempt to index field 'module' (a nil value)

Traceback

[C]: in function 'error'
[C]: in function 'xpcall'
I recently installed the engine and am creating a test project to see that I understand how to create and compile a blank game. So, I created a folder with the following files: TestGame => conf.lua; main.lua;

Code: Select all

function love.conf(t)
	t.module.joystick = false
	t.modules.audio = false
	t.modules.keyboard = true
	t.modules.event = true
	t.modules.image = true
	t.modules.graphics = true
	t.modules.timer = true
	t.modules.mouse = true
	t.modules.sound = true
	t.modules.threading = true
	t.modules.physics = true
	t.console = true 
	
	t.title = "TestGame"
	t.author = "BrokenEye"
	t.window.fullscreen = false
	t.window.vsync = false
	t.window.fsaa = 0
	t.window.height = 600
	t.window.width = 800
end
I'm sure this is a simple mistake, so apologies if I missed something. Thanks for looking.
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post by slime »

The first line underneath the love.conf declaration is 't.module.joystick = false' but it should be 't.modules.joystick = false' (plural modules.) Easy thing to miss. :)
brokenEye
Prole
Posts: 3
Joined: Fri Sep 25, 2015 1:17 am

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

Post by brokenEye »

Ah! So that's it. I eventually got angry and pasted a config from some game I found online.
I guess that's what happens when you try to do things yourself the first time. ha :P
bilal100
Prole
Posts: 1
Joined: Fri Apr 17, 2020 11:10 am

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

Post by bilal100 »

Hello, recently I have been having the same problem while I was making a pong game. These are the 2 scripts that I have:

Code: Select all

WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720

function love.load()
    love.window.setMode(WINDOW_WIDTH, WINDOW_HEIGHT,{
        fullscreen = false,
        resizable = false,
        vsync = true
    })
end

function love.draw()
    love.graphics.printf(
        'PONG!',       
        0,                    
        WINDOW_HEIGHT / 2 - 6,  
        WINDOW_WIDTH,          
        'center')               
end


AND THIS IS THE SECOND SCRIPT

Code: Select all

push = require 'push'

WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720

VIRTUAL_WIDTH = 432
VIRTUAL_HEIGHT = 243

function love.load()
    love.graphics.setDefaultFilter('nearest', 'nearest')
    push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
        fullscreen = false,
        resizable = false,
        vsync = true
    })
end

function love.keypressed(key)
    if key == 'escape' then
        love.event.quit()
    end
end

function love.draw()
     push:apply('start')
  love.graphics.printf('PONG', 0, VIRTUAL_HEIGHT / 2 - 6, VIRTUAL_WIDTH, 'center')
push:apply('end')
end

For the past 2 days, I have been stuck with this
tobiasvl
Prole
Posts: 29
Joined: Mon Oct 01, 2018 4:58 pm
Location: Norway
Contact:

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

Post by tobiasvl »

You've had literally the same problem as in the 5 year old post you replied to? Then can't you just solve it the same way as stated above?

I'm not sure what to make of the code you posted, it doesn't show your conf.lua and they seem to be two separate games since they both have a love.load and love.draw defined.

You should probably make a new thread with your problem, where you post your actual error message.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests