LuaCATS / love2d

Definitions for the LÖVE 2D game framework
10 stars 4 forks source link

inject-field diagnostics when defining LOVE callbacks. #2

Closed MikuAuahDark closed 3 weeks ago

MikuAuahDark commented 10 months ago

Cross-posted from here: LuaLS/lua-language-server#2316

Basically, with LuaLS 3.7.0, this throws a warning.

local love = require("love")

function love.load() -- Fields cannot be injected into the reference of `love` for `load`. To do so, use `---@class` for `love`. (inject-field)
end

I expect the love.load declaration to have no issues.

JJSax commented 3 weeks ago

Normally you shouldn't be requiring "love". If you're using love2d that is implied and called for you.

Taking that require out should solve your problem.

MikuAuahDark commented 3 weeks ago

Closing the one in here in favor of the LuaLS issue.