Remotes
Typed remotes with generated serializers
UpdatedOne declaration names the parameters, their wire widths, and the side that fires or asks. The compiler generates the serializer. fire, fire_all, on, and call are the whole surface.
Alloyremotes.aly
1export remote Damage(target: Player, @u16 amount: number) from client 2export remote Toast(message: string, seconds: number = 3) from server 3export remote function GetProfile(id: number) -> Profile from client 4 5Damage.on(function(player, target, amount) end) 6async do 7 local profile = await GetProfile.call(1) 8end
Emitted Luausame line count
1local __alloy = require("@alloy") local Damage = __alloy.remote({ name = "Damage", kind = "event", from_client = true, from_server = false, params = { "target", "amount" }, defaults = { }, attrs = {}, wire = { "inst:Player", "u16" } }) 2local Toast = __alloy.remote({ name = "Toast", kind = "event", from_client = false, from_server = true, params = { "message", "seconds" }, defaults = { seconds = 3 }, attrs = {}, wire = { "str", "f64" }, pack = false }) 3local GetProfile = __alloy.remote({ name = "GetProfile", kind = "function", from_client = true, from_server = false, params = { "id" }, defaults = { }, attrs = {}, wire = { "f64" }, pack = false }) 4 5Damage.on(function(player, target, amount) end) 6__alloy.future(function() 7 local profile = __alloy.await(GetProfile.call(1)) 8end) return { Damage = Damage, Toast = Toast, GetProfile = GetProfile }
from client,from server,from client or server; completion offers the sides in that order, and only there.@unreliable,@ratelimit,@timeout,@immediate,@validateshape one remote each.@u8to@f32set a number's wire width, on a remote parameter or a struct field.
