Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion unreal_asset/unreal_asset_base/src/types/fname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,19 @@

/// Get this `FName`'s content as a `String`
pub fn get_owned_content(&self) -> String {
self.get_content(str::to_string)
// Get access to this `FName`'s content as a string, along with it's instance number
let name = self.get_content(str::to_string);
let number = self.get_number();

// If the instance number is 0, just return the content string
// If the instance number is not 0, return the content string along with the instance index
if number == 0 {
name.clone()
}
else {
let instanceIndex = number - 1;

Check warning on line 154 in unreal_asset/unreal_asset_base/src/types/fname.rs

View workflow job for this annotation

GitHub Actions / build

variable `instanceIndex` should have a snake case name
name.clone() + "_" + &instanceIndex.to_string()
}
}

/// Checks if an `FName`'s content ends with the given `&str`
Expand Down
Loading