Skip to content

Simple key/value store #817

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
Apr 17, 2025
Merged

Simple key/value store #817

merged 1 commit into from
Apr 17, 2025

Conversation

systemed
Copy link
Owner

This provides a simple key/value store that can be accessed from Lua across threads. It's mainly intended for bringing in external data and config variables.

You can read data from file on the first call to init_function (which now has an is_first boolean), store values with SetData, and then access them with GetData afterwards.

The store is a string->string map. I did look at storing native Lua objects - it would have been nice to store tables! - but LuaRefs can't be shared across states, and deserialising an entire table every time way_function wants to look something up would be prohibitively slow.

@systemed systemed merged commit 0ebc1d7 into master Apr 17, 2025
5 of 7 checks passed
@systemed systemed deleted the kv_store branch April 17, 2025 09:59
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