- 致编者:请牢记我们的域名wiki.mcbe-dev.net!
- 致编者:欢迎加入本Wiki的官方交流QQ群或Discord服务器!
- 基岩版1.19.31现已发布!(了解更多)
- Inner Core现已支持Xbox模组联机!(了解更多)
- 如果您是第一次来到本Wiki,欢迎注册一个账户
- 点击顶部的“编辑”或“编辑源代码”按钮即可编辑当前页面
- 请知悉:在不登录时也可以编辑和新建页面,但是您当前的IP地址会记录在编辑历史中
Module:IDInfo/Gadget
来自Minecraft基岩版开发Wiki
local p = {}
function p.Yesno( str, yes, no)
local result = require( 'Module:Yesno' )( str, nil )
if result == nil then
return str
elseif result then
return yes or '是'
else
return no or '否'
end
end
function p.Match( path, value, label, field )
if value == nil then
return nil
end
local jsondata = mw.text.jsonDecode(mw.title.makeTitle('Data', path):getContent() or '{}')
for _, v in ipairs( jsondata ) do
if type( v ) == 'table' and ( tostring( v[ label ] ) == tostring( value ) or v[ field ] == value ) and v[ label ] ~= nil and v[ field ] ~= nil then
return tostring( v[ label ] ) .. ' (' .. v[ field ] .. ')'
end
end
return value
end
function p.IconBar( value, icon, title )
return mw.ustring.format(
'%s (%s%s)',
value,
tostring( require('Module:Iconbar').bar( { full = icon, size = 9, value = value > 10 and 2 or value, title = value .. '点' .. title } ) ),
value > 10 and ( '×' .. value / 2 ) or ''
)
end
return p