【发布时间】:2016-07-05 23:11:31
【问题描述】:
local pricetagColors = {
[3242] = {255, 0, 255},
[6712] = {255, 255, 0}
}
function getPricetagColor(itemnumber)
local r, g, b = 0, 0, 0
if pricetagColors[itemnumber] then
r, g, b = pricetagColors[itemnumber][1], pricetagColors[itemnumber][2], pricetagColors[itemnumber[3]
end
return {r, g, b}
end
好的,所以我现在正尝试逐步进入 C++。 现在我正试图弄清楚 C++ 中的(复杂的?)数组是如何创建的。 因为我不知道如何用另一种方式解释它,所以我在 LUA 中做到了,因为这是我最了解的。 函数并不重要,重要的是数组,因为我已经搜索了几个小时,但我不知道如何在 C++ 中完成你在 lua 中看到的数组。
【问题讨论】:
-
代码中的 id1 和 id2 是什么?
-
基本上只是一个代表项目的数字,例如第1234章
-
我稍微编辑了我的代码,这样可能会更清晰一些