This repository has been archived by the owner on Jul 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
802 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
The Base64 module allows for easy encoding and decoding of [Base64](https://en.wikipedia.org/wiki/Base64) values. | ||
|
||
-------------------- | ||
|
||
## Constructor | ||
|
||
### `Base64.new()` | ||
Constructs a new Base64 object. | ||
```lua | ||
local b64 = Base64.new() | ||
``` | ||
|
||
-------------------- | ||
|
||
## Methods | ||
|
||
### `Encode(String str)` | ||
Encodes the string into Base64 format. | ||
```lua | ||
local encoded = b64:Encode("Hello world") | ||
print(encoded) --> SGVsbG8gd29ybGQ= | ||
``` | ||
|
||
-------------------- | ||
|
||
### `Decode(String encodedStr)` | ||
Decodes the string from Base64 format. | ||
```lua | ||
local decoded = b64:Decode("SGVsbG8gd29ybGQ=") | ||
print(decoded) --> Hello world | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
The Date module allows for easy description of time. It is modeled after the JavaScript Date object. | ||
|
||
--------------------------- | ||
|
||
## Constructors | ||
|
||
### `Date.new([Number seconds [, Boolean useUTC]])` | ||
### `Date.fromJSON(String jsonString)` | ||
|
||
```lua | ||
local date = Date.new() -- Date as of right now | ||
local date = Date.new(1578329690, true) -- Date as of January 6, 2020, 4:55PM | ||
``` | ||
|
||
--------------------------- | ||
|
||
## Methods | ||
|
||
### `ToJSON()` | ||
Converts the Date object to a JSON string. | ||
|
||
```lua | ||
local jsonDate = date:ToJSON() | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `ToSeconds()` | ||
Returns the number of seconds representing the object. This is the most practical method to use for saving/serializing the date, since it has the smallest footprint. | ||
|
||
```lua | ||
local seconds = date:ToSeconds() | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `GetTimezoneHourOffset()` | ||
Get the timezone offset in hours. | ||
|
||
```lua | ||
local timezoneHourOffset = date:GetTimezoneHourOffset() | ||
print("Timezone offset in hours:", timezoneHourOffset) --> e.g. 5 | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `Format(String format)` | ||
Format the date string. See the [GNU Date Commands](https://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/) for relevant formats. | ||
|
||
```lua | ||
local date = Date.new() | ||
local format = date:Format("%B %d, %Y") | ||
print(format) --> e.g. January 6, 2020 | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `ToUTC()` | ||
Constructs and returns a new Date object with the time converted to [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time). | ||
|
||
```lua | ||
local localTime = Date.new() | ||
local utcTime = localTime:ToUTC() | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `ToLocal()` | ||
Constructs and returns a new Date object with the time converted from UTC time into local time. | ||
|
||
```lua | ||
local utcTime = Date.new():ToUTC() | ||
local localTime = utcTime:ToLocal() | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `ToISOString()` | ||
Returns the ISO string representation of the date. | ||
|
||
```lua | ||
print(date:ToISOString()) --> e.g. 2020-01-06T17:08:24.473 | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `ToDateString()` | ||
Returns a string representing the shorthand date. | ||
|
||
```lua | ||
print(date:ToDateString()) --> e.g. Mon Jan 6 2020 | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `ToTimeString()` | ||
Returns a string representing the time. | ||
|
||
```lua | ||
print(date:ToTimeString()) --> e.g. 17:10:28 | ||
``` | ||
|
||
--------------------------- | ||
|
||
### `ToString()` | ||
Returns a string representing the time and date combined. | ||
|
||
```lua | ||
print(date:ToString()) --> e.g. Mon Jan 6 2020 17:10:28 | ||
|
||
-- Also works with tostring: | ||
print(tostring(date)) | ||
``` | ||
|
||
--------------------------- | ||
|
||
## Properties | ||
|
||
### `Hour` | ||
The hour of the day. | ||
|
||
### `Minute` | ||
The minute of the day. | ||
|
||
### `Weekday` | ||
The numeric weekday. | ||
|
||
### `Day` | ||
The day of the month. | ||
|
||
### `Month` | ||
The numeric month. | ||
|
||
### `Year` | ||
The year. | ||
|
||
### `Second` | ||
The seconds since January 1, 1970. | ||
|
||
### `Millisecond` | ||
The milliseconds since January 1, 1970. | ||
|
||
### `Yearday` | ||
The day of the year. | ||
|
||
### `IsDST` | ||
Whether or not the date represents daylight saving time. | ||
|
||
--------------------------- | ||
|
||
## Operators | ||
|
||
Simple comparison operators can be used on dates. | ||
|
||
```lua | ||
local date1 = Date.new(0) | ||
local date2 = Date.new(100) | ||
local date3 = Date.new(100) | ||
print(date1 < date2) --> true | ||
print(date1 >= date2) --> false | ||
print(date2 == date3) --> true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Allows the creation of custom events. | ||
|
||
-------------------- | ||
|
||
## Constructor | ||
|
||
### Event.new() | ||
Creates a new Event object. | ||
```lua | ||
local event = Event.new() | ||
``` | ||
|
||
-------------------- | ||
|
||
## Methods | ||
|
||
### `Fire(Variant args...)` | ||
Fire the event with any number of arguments. | ||
```lua | ||
event:Fire("Hello world") | ||
``` | ||
|
||
-------------------- | ||
|
||
### `Wait()` | ||
Yields until the next time the event is fired, and returns anything that the fired event passed. | ||
```lua | ||
local message = event:Wait() | ||
``` | ||
|
||
-------------------- | ||
|
||
### `Connect(Function handler)` | ||
Connects a function to the event. The function will be called every time the event is fired. | ||
|
||
**Returns:** [Connection](https://developer.roblox.com/en-us/api-reference/datatype/RBXScriptConnection) | ||
```lua | ||
event:Connect(function(message) | ||
print("Event fired! Got message:", message) | ||
end) | ||
``` | ||
|
||
-------------------- | ||
|
||
### `DisconnectAll()` | ||
Disconnects all connected functions. | ||
```lua | ||
event:DisconnectAll() | ||
``` | ||
|
||
-------------------- | ||
|
||
### `Destroy()` | ||
Destroys the event, which also disconnects all connections. | ||
```lua | ||
event:Destroy() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
The ListenerList allows developers to keep a list of connections that can all be disconnected at the same time. This is useful when creating custom objects that need to be destroyed and cleaned up. | ||
|
||
-------------------- | ||
|
||
## Constructor | ||
|
||
### `ListenerList.new()` | ||
Creates a new ListenerList instance. | ||
```lua | ||
local listenerList = ListenerList.new() | ||
``` | ||
|
||
-------------------- | ||
|
||
## Methods | ||
|
||
### `Connect(event, func)` | ||
Connect to an event. | ||
|
||
**Returns:** [Connection](https://developer.roblox.com/en-us/api-reference/datatype/RBXScriptConnection) | ||
```lua | ||
listenerList:Connect(workspace.Changed, function(property) | ||
print("Workspace property " .. property .. " changed") | ||
end) | ||
``` | ||
|
||
-------------------- | ||
|
||
### `BindToRenderStep(name, priority, func)` | ||
Exactly the same as [RunService:BindToRenderStep](https://developer.roblox.com/en-us/api-reference/function/RunService/BindToRenderStep). See documentation there. | ||
```lua | ||
listenerList:BindToRenderStep("R", Enum.RenderPriority.Camera.Value, function() | ||
-- Render step | ||
end) | ||
``` | ||
|
||
-------------------- | ||
|
||
### `BindAction(name, func, btn [, inputTypes...])` | ||
The same as [ContextActionService:BindAction](https://developer.roblox.com/en-us/api-reference/function/ContextActionService/BindAction). | ||
|
||
-------------------- | ||
|
||
### `BindActionAtPriority(name, func, btn, priority [, inputTypes...])` | ||
The same as [ContextActionService:BindActionAtPriority](https://developer.roblox.com/en-us/api-reference/function/ContextActionService/BindActionAtPriority). | ||
|
||
-------------------- | ||
|
||
### `DisconnectAll()` | ||
Disconnect all events, and unbind both RenderStep and Action bindings. | ||
```lua | ||
listenerList:DisconnectAll() | ||
``` | ||
|
||
-------------------- | ||
|
||
### `DisconnectEvents()` | ||
Only disconnect events in the list. | ||
|
||
-------------------- | ||
|
||
### `DisconnectRenderSteps()` | ||
Only unbind any bound RenderSteps. | ||
|
||
-------------------- | ||
|
||
### `DisconnectActions()` | ||
Only unbind any bound actions. |
Empty file.
Oops, something went wrong.