Skip to content
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

feat(tableHelper): add getEntryKeyByValue #47

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

HotaruBlaze
Copy link

This is a kinda lazy way but only working way I found of handling #42, I initially tried to make it return the table to be modified, but it does not seem to work. So the closest i got was returning a matching key on match, and using that for the table.

Example of how i'm using it below.

local playerVoidStorageName = tableHelper.getEntryKeyByValue(WorldInstance.data.voidStorage, playerName)
if not playerVoidStorageName then
	WorldInstance.data.voidStorage[playerName] = { storageId = "", hasAccess = {} }
	playerVoidStorageName = playerName
else

local storageId = WorldInstance.data.voidStorage[playerVoidStorageName].storageId

Issue #46: Accidently pushed the non-working broken function attempt of returning a table instead of the key, aswell as named the branch the bad function pushed.

@HotaruBlaze HotaruBlaze self-assigned this Oct 23, 2023
@HotaruBlaze HotaruBlaze added bug Something isn't working enhancement New feature or request labels Oct 23, 2023
lib/lua/tableHelper.lua Outdated Show resolved Hide resolved
lib/lua/tableHelper.lua Outdated Show resolved Hide resolved
lib/lua/tableHelper.lua Show resolved Hide resolved
@HotaruBlaze HotaruBlaze force-pushed the feat/tablehelper-getEntryKeyByValue branch from c6a6d04 to b6d2b66 Compare October 23, 2023 10:36
@HotaruBlaze
Copy link
Author

Addressed the comments, just did a force push to reuse the commit message cuz I'm still waking up. should all be good now, tested it to make sure it still works fine.

lib/lua/tableHelper.lua Outdated Show resolved Hide resolved
@HotaruBlaze HotaruBlaze merged commit fea218d into master Oct 23, 2023
@HotaruBlaze HotaruBlaze changed the title feat(tableHelper): add getEntryInTableByValue feat(tableHelper): add getEntryKeyByValue Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants