Skip to main content

@rbxts/expect > LuaEnum

LuaEnum type

A user-defined enum, as it would be defined in the transpiled Lua.

Signature:

type LuaEnum = Record<string | number, string>;

Remarks

Used for type safe identification of enum tables.

Example

enum Sport {
Basketball,
Football,
Soccer
};

function PrintEnumValue(enum: LuaEnum, value: keyof LuaEnum) {
print(enum[value]);
}

PrintEnumValue(Sport, "Soccer");