【发布时间】:2020-11-19 06:09:39
【问题描述】:
我是编码新手,最近开始在 LUA 中迈出第一步。我有一个小问题,所以如果你能帮助我,那将非常有帮助。在我的代码中,我需要编写代码
If x ~= 1 and x~=2 and x~=3 and x~=4 then (do something) end
有没有更快的方法不对该部分进行硬编码,而不是将整个内容从 x~=1 输入到 x~=4?
谢谢!
【问题讨论】:
-
if x > 4 then -
local t={[1]=true, [2]=true, [3]=true, [4]=true}; if not t[x] then...
标签: if-statement lua love2d