Methods
Jack5079 opened this issue · 3 comments
Jack5079 commented
The Methods API brings a typed API for creating commands and actions. With Adapters, the Methods API will allow developers to write once then deploy with any (supported) UI lib.
local api = ...
local Method = api.Method
local all = api.all -- something like Promise.all but for Lua
local part = Method {
Name = "part",
DisplayName = "Part at player",
Description = "Spawns a part at a player",
Replicates = true,
Run = function (args)
all(args.People, function (player)
Instance.new('Part', workspace):SetPivot(player.Character:GetPivot())
end)
end,
Arguments = {
People = {
Required = true,
Type = 'players'
}
}
}
-- you'll be able to run Methods programatically
part {
People = game:GetService('Players'):GetPlayers()
}
-- you'll be able to modify properties of your Methods as well
part.Disabled = math.random() > 0.5
return {
Name = "Methods API demo",
-- to export a method put it in the table
part,
}
Jack5079 commented
need to fix bracket next
Jack5079 commented
fuck this we need to make it a standard supported by every admin script
Jack5079 commented
or maybe not
let's call Exports Methods too