j'ai une erreur de compilation avec lua:Erreur lors de la définition d'une fonction en utilisant un nom de champ (' « (» prévu à côté de « [ » `)
local action = {}
action["moving"] = {}
action["zooming"] = {}
action["moving"].state = false
action["zooming"].state = false
action.list = {"moving", "zooming"}
function action["moving"].f()
if CanAction("moving") and (love.keyboard.isDown("left") or love.keyboard.isDown("right") or love.mouse.isDown("l")) then
if action["moving"].state == false then
action["moving"].x, action["moving"].y = camera:mousePosition()
action["moving"].state = true
end
if action["moving"].state then
if love.mouse.isDown("l") then
camera:setPosition(-love.mouse.getX()*camera.scaleX + action["moving"].x, -love.mouse.getY()* camera.scaleY + action["moving"].y)
elseif love.keyboard.isDown("left") then
camera:move(-10*camera.scaleX, 0)
elseif love.keyboard.isDown("right") then
camera:move(10*camera.scaleX, 0)
end
end
else
ResetAction("moving")
end
end
L'erreur est sur la ligne lorsque Je déclare la function "function action [" moving "]. f()", peut-être parce que j'utilise une table comme ça, merci pour votre aide
(Ma fonction est complète, ne vous inquiétez pas à ce sujet) – Mathurin31