Skip to content
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

docs(developers): add documentation for MessagePack #503

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JustGodWork
Copy link

This pull request introduces comprehensive documentation for the MessagePack integration in FiveM, detailing its features, reserved types, and usage in Lua and JavaScript runtimes. The C# section is marked as TODO to allow future contributions.

This documentation complements citizenfx/fivem#2931, which globally exposes the MessagePack codec (msgpack_pack and msgpack_unpack) to enhance cross-runtime data serialization and deserialization.

Key Updates:

  • MessagePack Overview:

    • Introduction to the binary serialization format and its support across Lua, JavaScript, and C#.
    • Features like compact serialization and cross-language compatibility.
  • Reserved Extension Types:
    A table of FiveM-specific types, such as Vector2, Vector3, and others.

  • Lua API:

    • Documentation for built-in functions (msgpack.pack, msgpack.pack_args, msgpack.unpack) with practical examples.
    • Guide to adding custom types for serialization.
  • JavaScript API:

    • Explanation of global codec functions (msgpack_pack, msgpack_unpack) and custom codec usage.
    • Examples of encoding, decoding, and extending types.
  • Example Scenarios:
    Real-world cases of cross-runtime data handling (Lua to JavaScript, JavaScript to C#, and C# to Lua).

Reason for the Update:

This documentation supports the recent enhancement from citizenfx/fivem#2931, ensuring developers can effectively utilize the MessagePack codec for optimized data handling across all FiveM-supported runtimes.
Preview:

The document is located at content/docs/scripting-reference/msgpack.md.

Feedback Requested:

  • Suggestions for improving clarity or adding examples.
  • Contributions to the C# API section.


```ts
enum ReservedExtensionTypes {
FunRef = 10,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't you mean “FuncRef” instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants