I'm also a beginner, but if you want to set the audio function in a extern .lua file try it like this:
audio.lua:
Code: Select all
function playMusic()
music = love.audio.newSource("hurricane.ogg")
love.audio.setVolume(1.0)
love.audio.play(music)
end
Code: Select all
require "audio"
function love.load()
playMusic()
end
This will start the "playMusic" function in the audio.lua when the game starts.
Please correct me, if this is wrong or there are better solutions.