#Dynamic property lists
1 messages · Page 1 of 1 (latest)
Just use dynamic properties?
It doesent accept that type
JSON.stringify()
And how do I reverse that
Parse.
world.setDynamicProperty('coddy:test', JSON.stringify({ test: 2, bruh: 'hello' });
const data = JSON.parse(world.getDynamicProperty('coddy:test') || '{}');```
Ok I’ll try that
@lethal lily I don’t want to have to use the : I just want a list example like ‘test1’, ‘test2’, ‘test3’
Still stringify it, instead of JSON.stringify({ ... }) it's JSON.stringify([ ... ]) same goes to parsing instead of || '{}' it's || '[]'
Alright
And how do I append to a list or remove all items with a certain name
Like remove all items that are for example “test”
const data = JSON.parse(world.getDynamicProperty('coddy:test') || '[]');
const filtered = data.filter(item => item.name !== 'test');
world.setDynamicProperty('coddy:test', JSON.stringify(filtered));
And how do I append an item
push.js data.push('coddy');
pls, do some research, I can't always help you.
Ok
Bro it’s completely not working at all like it just adds 1 to the number when I add anything to it and just says [2] or whatever number and the remove thing does absolutely nothing, and there’s no errrors
It doesent work
Then do some researchs
try checking the values saved
try debugging mann
console.error(JSON.stringify(world.getDynamicProperty('coddy:test'));```
I'm not an AI you can just tag always.
Push is broken to the point that it adds +1 Thats it
Base js methods work completely fine; how are you using it?
You're definitely doing something wrong because it works PERFECTLY fine with me.
it doesn't make sense that it will add a number if in push you add a string.
the way to display or get the value is the problem