1

我一直在尝试为我的朋友和我正在做的一个小项目制作一个主菜单。我在用于玩家重力的第 133 行遇到了这个错误(我的朋友编码了那部分)。听到是代码,将不胜感激:

我无法让代码块工作,所以把它放在这个 URL 上

http://pastebin.com/ue09X0Bi

PS 非常抱歉,我无法让代码块工作。

4

1 回答 1

2

The global variable p is used throughout the code but is not assigned anywhere, so its value is logically nil.

Note: it is unusual and not recommendable to have a global variable with a such short name.

EDIT: from the new link you provide in the comment, p is set inside function loadgeneral contained in player.lua. This means that loadgeneral is not called, although it is present at line 19 in function love.load of your script. This is probably normal, since gamestate is there set to "menu" and you immediately compare that variable to "playing", which will always yield false!

于 2013-01-06T10:20:16.827 回答