BeamMP-Server icon indicating copy to clipboard operation
BeamMP-Server copied to clipboard

`MP.Get` and `MP.Set` improvements

Open lionkor opened this issue 1 year ago • 1 comments

New Lua API features:

  • MP.Get(category, key) -> string|number|table
  • MP.Set(category, key, value) as an overload to existing MP.Set(enum)

Set settings should not be persisted, that is a different problem to tackle.

The following should work, for example:

MP.Set("General", "Name", "Hello, World!")
local name = MP.Get("General", "Name")

and name, of course, is "Hello, World!".

Acceptance Criteria

  • [ ] MP.Get and MP.Set behavior should be as described
  • [ ] Return (nil, error) on failure
  • [ ] Failure case for invalid value type given to MP.Set
  • [ ] Failure case for non-existant category or key, currently no support for custom keys and categories

lionkor avatar Jan 17 '24 11:01 lionkor

I think the described behavior is not achievable with current primitives in the server. Extensive filtering of categories like this sounds like a perfect use case for a database imo.

jimkoen avatar Feb 26 '24 08:02 jimkoen