Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops 如何检查日期列表是否包含今天';她在卢阿的约会?_Loops_Search_Lua - Fatal编程技术网

Loops 如何检查日期列表是否包含今天';她在卢阿的约会?

Loops 如何检查日期列表是否包含今天';她在卢阿的约会?,loops,search,lua,Loops,Search,Lua,我想编写一个代码,自动检查今天的日期是否与给定表中的某个日期匹配。我不太熟悉Lua(仍在学习),但我确实知道如何使用时间函数。然而,我正在使用的平台只支持Lua 5.0,因此不支持yday(%j)函数,这使得它更加复杂。您可以尝试使用以下代码格式化日期: -- CURRENT DATE local myyear = os.date("*t").year local mymonth = os.date("*t").month; if mymonth < 10 then mymonth = "

我想编写一个代码,自动检查今天的日期是否与给定表中的某个日期匹配。我不太熟悉Lua(仍在学习),但我确实知道如何使用时间函数。然而,我正在使用的平台只支持Lua 5.0,因此不支持yday(%j)函数,这使得它更加复杂。

您可以尝试使用以下代码格式化日期:

-- CURRENT DATE
local myyear = os.date("*t").year
local mymonth = os.date("*t").month; if mymonth < 10 then mymonth = "0"..mymonth end
local myday = os.date("*t").day; if myday < 10 then myday = "0"..myday end
local today = myyear..mymonth..myday
print(today)
——当前日期
本地myyear=os.日期(“*t”).年
本地mymonth=os.date(“*t”).month;如果mymonth<10,则mymonth=“0”。mymonth结束
本地myday=os.date(“*t”).day;如果myday<10,则myday=“0”。myday结束
本地今日=我的年..我的月..我的日
印刷(今日)
然后检查日期是否在您的表中。 希望这不是太复杂,可以有所帮助

PS:我使用的是使用lua的gideros引擎