1
我使用的函數在運行時給我提供了'end' expected (to close 'if' at line 11) near 'until'
錯誤,但我檢查了並且我沒有忽略'end'
整個程序。另外,我沒有使用回報或其他一些命令一樣,(我所知道的)Lua'end'預計(如果'在第11行'關閉')直到'
function sell_item(item, soldfor)
items_found = 0
for i, v in pairs(inv) do
if v == item then
items_found = items_found + 1
end
end
if items_found ~= 0 then
items_destroyed = 0
until items_destroyed == 1 do
for i, v in pairs(inv) do
if v == item then
pop_inv(item)
items_destroyed = 1
io.write(item .. " sold for " .. soldfor .. " coins")
count = 0
while count ~= soldfor do
table.insert(money, "coin")
count = count + 1
end
count = 0
end
end
items_destroyed = 0
end
elseif items_found == 0 then
io.write("You do not have this item")
end
end
你的'if'缺少'then'。 – daurnimator
@daurnimator忘了更新, – IcecreamSwirlys