red-blox / zap

A lightning fast networking solution for roblox.
https://zap.redblox.dev
MIT License
94 stars 16 forks source link

[FEAT] Support for Namespaces #29

Open sasial-dev opened 10 months ago

sasial-dev commented 10 months ago

Describe your feature

In a large complex game, the remotes used can generally be grouped into categories. Zap should support a namespace under the event struct, and when a namespace is specified, you should be able to access it through remotes.namespace.remote_name.

Alternatives

Implementation Details

This should be implimented under the event struct with an optional namespace field.

jackdotink commented 10 months ago

An alternative syntax for this rather an an event namespace field could be this:

namespace n = {
    type t = u8
    event e = {
        from: Server,
        type: Reliable,
        call: SingleAsync,
        data: t
    }
}

-- this also allows us to use types from namespaces
type t_from_n = n.t
sasial-dev commented 10 months ago

I do like that alternative syntax better!