Skip to content

feat: add map_get function for cloning and returning values from a map #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

makspll
Copy link
Owner

@makspll makspll commented Mar 3, 2025

Summary

  • Adds map_get binding
  • Same signature as get but is a temporary stop gap for the lack of support for reflecting into hashmaps from get (due to missing functionality upstream in Bevy)
  • The values are returned by value not by reference
  • Adds some docs around the area
local Resource = world.get_type_by_name("TestResourceWithVariousFields")
local resource = world.get_resource(Resource)

assert(resource.string_map:map_get("foo") == "bar", "Expected bar, got " .. resource.string_map:map_get("foo"))

Came out from the discussion around #341

@makspll makspll enabled auto-merge (squash) March 3, 2025 14:49
@makspll makspll changed the title feat: add map_get function for cloning and returning values on a map feat: add map_get function for cloning and returning values from a map Mar 3, 2025
@makspll makspll merged commit 70302f8 into main Mar 3, 2025
19 checks passed
@makspll makspll deleted the feat/map-get-function branch March 3, 2025 15:36
This was referenced Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant