Bugala wrote: ↑Mon Feb 24, 2025 12:21 pm
JSON cant handle having Hollywood Dates as Indexes either. It can Handle Hollywood Date as Content, but not as Index:
This is because you're using #SERIALIZEMODE_HOLLYWOOD (the default mode, see
SetSerializeMode()) which does impose some restrictions on key names. In this case it's the space character in the index that's causing problems because that character is reserved when using #SERIALIZEMODE_HOLLYWOOD. If you switch to #SERIALIZEMODE_NAMED, it will be possible to use indices with space characters, so this will work fine:
Code: Select all
SetDefaultAdapter(#ADAPTER_SERIALIZE, "default")
SetSerializeMode(#SERIALIZEMODE_NAMED)
Local ToDate = { Year = 2025, Mon = 1, MDay = 1, Hour = 0, Min = 0, Sec = 0}
ToDate = MakeDate(ToDate)
MyTable = { [TODate] = 1 }
OpenFile(1, "testi", #MODE_WRITE)
WriteTable(1, MyTable)
CloseFile(1)
Bugala wrote: ↑Wed Feb 19, 2025 2:19 pm
Also, just noticed that JSON cant handle userdata at all, not even in: TestTable[n] = userdata but this might be expected?
Absolutely. It's impossible to serialize userdata because that's mostly pointing to a block of memory allocated at runtime. Trying to serialize this data doesn't make sense. So clearly a feature.