I don’t think so, but what is the use case?
From there, the road to being able to read/write arbitrary lua values to memory is relatively straightforward. (Write a "type" byte followed by the value's data)
Now, to deal with data larger than 128 bytes, you could create a simple protocol that allows passing arbitrarily large data.
Example simple protocol:
0x5f80..0x5ffe : 127 data bytes
0x5fff : 1 once partial data is written, 0 once data is read, 2 once complete data is written.
E.g. if JS wants to send write a big value that's encoded into 150 bytes, it would:
- Write the first 127 bytes to 0x5f80..0x5ffe
- Write 1 to 0x5fff (partial data available)
- Wait for 0x5fff to become 0
- Write the next 23 bytes to 0x5f80..0x5ffe
- Write 2 to 0x5fff (full data available)
- Wait for 0x5fff to become 0 before doing anything else
The P8 side, meanwhile, would read 0x5fff every frame and - if non-0 - concat the data with any previously received partial data (in memory or in a variable) and - if 2 - process it.
It could then even return data back to JS via the same protocol. (this will work as long as both sides agree on who is reading and who is writing)
[Please log in to post a comment]