Closed TheMeq closed 6 years ago
I have this has my main.lua
`Gamestate = require 'libs.hump-gamestate' Camera = require 'libs.hump-camera' Vector = require 'libs.hump-vector' require 'libs.colors-rgb'
music = require('libs.cargo').init('music') image = require('libs.cargo').init('image') sound = require('libs.cargo').init('sound') fonts = require('libs.cargo').init('fonts') state = require('libs.cargo').init('state')
require 'state.welcome'
function love.load() Gamestate.registerEvents() Gamestate.switch(welcome) end`
and in my welcome.lua I have this
`welcome = {}
function welcome:draw() love.graphics.setFont(baseFont) love.graphics.print("Test",10,10)
end
function welcome:update(dt)
function welcome:load() baseFont = fonts.main_font(16) end`
but it is giving me this error message:
`Error
state/welcome.lua:4: bad argument #1 to 'setFont' (Font expected, got nil)
Traceback
[C]: in function 'setFont' state/welcome.lua:4: in function 'draw' [C]: in function 'xpcall'`
Fixed it, nvm :D
I have this has my main.lua
`Gamestate = require 'libs.hump-gamestate' Camera = require 'libs.hump-camera' Vector = require 'libs.hump-vector' require 'libs.colors-rgb'
music = require('libs.cargo').init('music') image = require('libs.cargo').init('image') sound = require('libs.cargo').init('sound') fonts = require('libs.cargo').init('fonts') state = require('libs.cargo').init('state')
require 'state.welcome'
function love.load() Gamestate.registerEvents() Gamestate.switch(welcome) end`
and in my welcome.lua I have this
`welcome = {}
function welcome:draw() love.graphics.setFont(baseFont) love.graphics.print("Test",10,10)
end
function welcome:update(dt)
end
function welcome:load() baseFont = fonts.main_font(16) end`
but it is giving me this error message:
`Error
state/welcome.lua:4: bad argument #1 to 'setFont' (Font expected, got nil)
Traceback
[C]: in function 'setFont' state/welcome.lua:4: in function 'draw' [C]: in function 'xpcall'`