安装 Steam
登录
|
语言
繁體中文(繁体中文)
日本語(日语)
한국어(韩语)
ไทย(泰语)
български(保加利亚语)
Čeština(捷克语)
Dansk(丹麦语)
Deutsch(德语)
English(英语)
Español-España(西班牙语 - 西班牙)
Español - Latinoamérica(西班牙语 - 拉丁美洲)
Ελληνικά(希腊语)
Français(法语)
Italiano(意大利语)
Bahasa Indonesia(印度尼西亚语)
Magyar(匈牙利语)
Nederlands(荷兰语)
Norsk(挪威语)
Polski(波兰语)
Português(葡萄牙语 - 葡萄牙)
Português-Brasil(葡萄牙语 - 巴西)
Română(罗马尼亚语)
Русский(俄语)
Suomi(芬兰语)
Svenska(瑞典语)
Türkçe(土耳其语)
Tiếng Việt(越南语)
Українська(乌克兰语)
报告翻译问题
if _G.rawget(_G,"Insight") and _G.Insight~=nil then
Otherwise it will most likely crash if the mod runs withoug Insight enabled?!
I was writing an example in response to your question, and realized that there's no good way to do it at the moment since descriptors' Describe can return a bunch of nils or tables. I'll have to think about what can be done.
That being said, here's the example. This sort of thing is probably the best option at the moment.
(edited after your first response)
small question:
The code checks for "v.name", while your example code in the first post does not return a "name". Is this added automatically by your mod? Or should we always add a name to the returned values?
And maybe also add "alt_description" to your example.
It's another one of those issues in the example where modding the describe functions is difficult. If a descriptor returns a table without a name field, it gets automatically added in later. I specify the name ahead of time if the Describe returns multiple tables, since it's a requirement in that case. When there isn't a name, you just hope it's the first return.
In your case, since you're modifying edible, it already has the name so you should be okay.
I would change this:
If it's not a table, that means it's probably false, which means it likely hit an error during loading. You'd just be suppressing the error at that point, which is not recommended. Better to see why it's erroring.
I edited the code above to check for "false" and only set edible a new table if is no table yet. Unless you need no other "non-table" values, this should be fine now I guess.
descriptors is a metatable. When you index it to check for a descriptor, it first tries to load it if it hasn't been loaded yet. The descriptor should never be nil. It will always be a table or false.
The callback is called with the component and table of data returned from the descriptor's Describe.