table.unpack丢失元素的几种情况
一、将table.unpack语句与and、or、not等连用
local ext = {1, 2, 3}
print("正确结果:", table.unpack(ext))
print("错误结果:", ext and table.unpack(ext))
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
输出:
正确结果: 1 2 3
错误结果: 1
local ext = {1, 2, 3}
print("正确结果:", table.unpack(ext))
print("错误结果:", ext and table.unpack(ext))
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
输出:
正确结果: 1 2 3
错误结果: 1