Lua(Love2D)中嵌套的"IF"条件存在问题

每当我按下空格键时,就会出现以下错误:"未能调用字段"resume"重要的值。"

我想让一个空格键停止音频,再按一次空格键来恢复播放。

if( 键== "space"then
    love.audio.pause()
    paused = true
end
if paused == true then
    if( 键== "space"then
        love.audio.resume()
    end
end

我尝试过的事情:

改变"=="为"=",反之亦然;

使用"and"避免嵌套的"if"语句。

文档(如有需要):http://love2d-community.github.io/love-api/#audio_resume

非常感谢您的帮助和时间。

点赞
用户1847592
用户1847592
如果键值等于 "space",则
   如果暂停,则
      love.audio.resume()
   否则
      love.audio.pause()
   结束
   暂停 = 不暂停
结束

但是在 LÖVE 11 中,love.audio.resume 已被删除。

请改用 love.audio.play

2018-04-07 04:40:33