Skip to Content
Kinemium
Datatypes

Miscellaneous

Axes, Faces, UniqueId, Content, DateTime, Random, and SecurityCapabilities.

Axes

Axes.new(...) builds a set from up to three Enum.Axis values.

local flat = Axes.new(Enum.Axis.X, Enum.Axis.Z)
print(flat.Y) -- false
Constructor or constantDescription
Axes.new(axis...)Enables the axes you pass.
Axes.noneNo axes.
Axes.allEvery axis.
MemberTypeDescription
XbooleanX axis enabled.
YbooleanY axis enabled.
ZbooleanZ axis enabled.

Equality compares all three flags.

Faces

Faces.new(...) builds a set from up to six Enum.NormalId values.

Constructor or constantDescription
Faces.new(normalId...)Enables the faces you pass.
Faces.noneNo faces.
Faces.allEvery face.
MemberTypeDescription
Top, Bottom, Left, Right, Front, BackbooleanWhether that face is enabled.

UniqueId

UniqueId.new() generates an identifier.

MemberTypeDescription
RandomnumberRandom component.
TimenumberTime component.
IndexnumberCounter component.

Equality compares all components. tostring() returns the compact identifier.

Content

Content points at an asset URI or an instance. Properties such as image and sound sources accept it.

ConstructorDescription
Content.fromUri(uri)Reference to an asset URI.
Content.fromObject(instance)Reference to an instance.
MemberTypeDescription
UristringURI when the content is URI-backed, otherwise an empty string.
IsObjectbooleanWhether the content points at an object.
IsUribooleanWhether the content is URI-backed.
ObjectIdnumberObject identifier when object-backed, otherwise 0.
GetObject()Instance?The referenced instance, or nil.

DateTime

DateTime stores a point in time.

local now = DateTime.now()
print(now.UnixTimestamp)
ConstructorDescription
DateTime.now()Current time.
DateTime.fromUnixTimestamp(seconds)From Unix seconds.
DateTime.fromUnixTimestampMillis(milliseconds)From Unix milliseconds.
DateTime.fromIsoDate(iso)Parses an ISO 8601 string. Returns nil when the whole string is not a valid date.
Member or methodTypeDescription
UnixTimestampnumberSeconds since the Unix epoch.
UnixTimestampMillisnumberMilliseconds since the Unix epoch.
FormatLocalTime(format, locale)stringFormats the time in local time. Supports format = "LTS" with locale = "en-US"; other values raise an error. Available on native builds, not on the web target.

Random

Random.new(seed?) creates a random number generator. Without a seed it uses a system-generated one.

local rng = Random.new(1234)
print(rng:NextInteger(1, 6))
MethodReturnsDescription
Clone()RandomCopy with the same state.
NextInteger(min, max)numberInteger between min and max.
NextNumber()numberNumber from 0 to 1.
NextNumber(min, max)numberNumber between min and max.
NextUnitVector()Vector3Unit vector with a random direction.
Shuffle(table)Shuffles the array part in place.

NextNumber accepts either no arguments or exactly two. Shuffle raises an error if the table contains nil.

SecurityCapabilities

A set of capabilities used by the sandbox and extension APIs.

ConstructorDescription
SecurityCapabilities.new(capability...)Builds a set from Enum.SecurityCapability values or other sets.
SecurityCapabilities.fromCurrent()Copies the capabilities of the current thread.
MethodReturnsDescription
Add(capability...)SecurityCapabilitiesNew set with the capabilities added.
Remove(capability...)SecurityCapabilitiesNew set with the capabilities removed.
Contains(capability...)booleanWhether every given capability is present.

See also

On this page