Code: Select all
function love.load(require player.)
i just put it at the start of main.lua before love.load.
Code: Select all
function love.load(require player.)
This is invalid Lua. It expects parameter names in the function definitions, it doesn't evaluate expressions.plz_m0ve wrote:Code: Select all
function love.load(require player.lua)
Code: Select all
function love.load()
require("player")
end
Lua manual wrote:A call of the form f{fields} is syntactic sugar for f({fields}); that is, the argument list is a single new table. A call of the form f'string' (or f"string" or f[[string]]) is syntactic sugar for f('string'); that is, the argument list is a single literal string.
When i do what you do with the love.loadBoolsheet wrote:This is invalid Lua. It expects parameter names in the function definitions, it doesn't evaluate expressions.plz_m0ve wrote:Code: Select all
function love.load(require player.lua)
require is just a regular function. You can call it whenever and the module gets loaded. There's no rule where you have to put it, it's mainly your design decision. However, you have to be aware that if you put it before love.load, it will get executed first. It will break if something in the other file relies on a global that is set in love.load.
Lua has some syntax sugar that allows you to drop the parentheses if the only argument is a string literal or table constructor.Code: Select all
function love.load() require("player") end
Lua manual wrote:A call of the form f{fields} is syntactic sugar for f({fields}); that is, the argument list is a single new table. A call of the form f'string' (or f"string" or f[[string]]) is syntactic sugar for f('string'); that is, the argument list is a single literal string.
Code: Select all
function love.load(require player.lua)
Code: Select all
')' expected near "player.lua"
I'm not exactly sure what you're doing wrong, but calling a require function usually looks like this:plz_m0ve wrote:When i do what you do with the love.loadBoolsheet wrote:This is invalid Lua. It expects parameter names in the function definitions, it doesn't evaluate expressions.plz_m0ve wrote:Code: Select all
function love.load(require player.lua)
require is just a regular function. You can call it whenever and the module gets loaded. There's no rule where you have to put it, it's mainly your design decision. However, you have to be aware that if you put it before love.load, it will get executed first. It will break if something in the other file relies on a global that is set in love.load.
Lua has some syntax sugar that allows you to drop the parentheses if the only argument is a string literal or table constructor.Code: Select all
function love.load() require("player") end
Lua manual wrote:A call of the form f{fields} is syntactic sugar for f({fields}); that is, the argument list is a single new table. A call of the form f'string' (or f"string" or f[[string]]) is syntactic sugar for f('string'); that is, the argument list is a single literal string.then it saysCode: Select all
function love.load(require player.lua)
When i try to add it, it says it again? Someone know why?Code: Select all
')' expected near "player.lua"
Code: Select all
require "player"
Code: Select all
function love.load()
require "player"
end
Code: Select all
require "player"
function love.load()
end
function love.update()
end
function love.draw()
end
Users browsing this forum: No registered users and 0 guests