Closed lc12345 closed 3 months ago
---获取最终属性 ---@param attr_name string | y3.Const.UnitAttr 属性名 ---@return number function M:get_final_attr_ex(attr_name) local attr = self.phandle:api_get_float_attr(attr_name) if attr then return attr:float() else return 0 end end
某种情况,获取的attr是nil,float()直接报错了
---获取最终属性 ---@param attr_name string | y3.Const.UnitAttr 属性名 ---@return number function M:get_final_attr_ex(attr_name) local attr = self.phandle:api_get_float_attr(attr_name) if attr then return attr:float() else return 0 end end
某种情况,获取的attr是nil,float()直接报错了