{"id":"averyark/adk","name":"adk","scope":"averyark","platform":"roblox","description":"Astrax Development Kit (ADK) provides a collection of helpful libraries that are vital to lazy programmers such as myself.","version":"2.0.5","latest":"2.0.5","versions":["2.0.0","2.0.1","2.0.3","2.0.4","2.0.5"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"penguindevs/boattween":{"version":"^1.0.1","alias":"BoatTween"},"howmanysmall/janitor":{"version":"^1.14.2","alias":"Janitor"},"brittonfischer/profileservice":{"version":"^2.1.5","alias":"ProfileService"},"evaera/promise":{"version":"^4.0.0","alias":"Promise"},"uncontained0/red":{"version":"^1.0.0","alias":"Red"},"sleitnick/signal":{"version":"^1.0.1","alias":"Signal"},"tpc9000/tableutil":{"version":"^0.1.1","alias":"TableUtil"},"osyrisrblx/t":{"version":"^3.0.0","alias":"t"}},"integrity":"a747b98d94129c83e7c815b633e5d651ba7599d73734065206ab10700624f5be","likes":0,"downloads":0,"install":"forest install averyark/adk","url":"https://forest.dev/p/roblox/averyark/adk","files":"https://api.forest.dev/ai/package/roblox/averyark/adk/files","readme":"## Astrax Development Kit\r\nAstrax Development Kit (ADK) provides a collection of helpful libraries that are vital to slothful programmers such as myself.\r\n\r\n### Getting started\r\nAstrax requires minimal setup before you can begin using it. The core usage of Astrax is the same on the Server and Client. To begin, call `astrax.module.setModuleFolder(folder)` with the ancestry folder for all your modules. After you set your module folder, call the `astrax.start` function to boot up Astrax. The `astrax.start` function returns a **Promise**, you can chain `:await()` to yield until all modules are loaded.\r\n```lua\r\nlocal astrax = require(game:GetService(\"ReplicatedStorage\").Packages.Astrax)\r\n\r\n-- .setModuleFolder() should be called before .start()\r\nastrax.setModuleFolder(script.Parent)\r\nastrax.start():catch(warn):andThen(function() \r\n    print(\"Astrax has initialized successfully\")\r\nend):await()\r\n```\r\n\r\n### Libraries\r\nSome libraries do not run until you call `astrax.start`, so ensure the function is called before you use it. All libraries are reachable from the astrax module.\r\n\r\n#### Data Handler\r\nHave you ever been bothered by the countless events you need to create just to communicate to the client when you updated the player's data? That's not a problem now with the data library. The data handler allows listening to individual paths in a data table with a simple function call!\r\n\r\n```lua\r\n-- On the server, we're giving the player coins\r\nlocal astrax = require(game:GetService(\"ReplicatedStorage\").Packages.Astrax)\r\n\r\ngame:GetService(\"Players\").PlayerAdded:Connect(function(player)\r\n    -- Retrieve the object for the player, this method yields\r\n    local playerData = astrax.dataServer.getPlayer(player)\r\n\r\n    -- Any change that has to replicate to the client must be wrapped within a :apply call\r\n    playerData:apply(function(data)\r\n        data.Coins += 100\r\n    end)\r\nend)\r\n```\r\n\r\n```lua\r\n-- On the client\r\nlocal astrax = require(game:GetService(\"ReplicatedStorage\").Packages.Astrax)\r\n\r\n-- The function is called when the data is first initialized. changes.old is always nil for the initialization call\r\n-- With that in mind you'll observe two prints\r\n-- First is the initial data and second is the coins added by the server\r\nastrax.dataClient:connect({\"coins\"}, function(changes)\r\n    print(changes.old, changes.new)\r\n    -- nil, 0\r\n    -- 0, 100\r\nend)\r\n```\r\n\r\n#### Class\r\nThe class module provides utility and enables debugging. Create a Class with `astrax.class.new(identifier, methods)` and create an object with `astrax.class.construct(metatable, class)`.\r\n\r\n```lua\r\nlocal methods = {}\r\n\r\n-- Unfortunatley due to luau limitations, you have to implicitly type self with typeof(new())\r\nfunction methods.foo(self: class)\r\n    self.x = 1\r\nend\r\n\r\n-- This function is automatically called when the object is initialized\r\nfunction methods.__init__(self: class)\r\n    self._maid:Add(self.part)\r\n    self:foo()\r\nend\r\n\r\nlocal class = astrax.class.new(\"object\", methods)\r\n\r\nlocal new = function()\r\n    local meta = {}\r\n\r\n    meta.a = 1\r\n    meta.b = \"something\"\r\n    meta.c = true\r\n    meta.x = nil :: number?\r\n    meta.part = Instance.new(\"Part\")\r\n\r\n    return astrax.class.construct(meta, class)\r\nend\r\n\r\n-- Class type\r\ntype class = typeof(new())\r\n```","readmeTruncated":false}