Syntactical Differences
There are several syntactical differences in WCS between Luau version and TypeScript version.
One of the most big being how classes are exported.
Classes in WCS are used to define your status effect or an ability.
In TypeScript package version WCS explicitly exports classes Skill
, StatusEffect
and HoldableSkill
that you should decorate and extend from.
However, due to the funky emit syntax in Luau WCS exports special "wrapper" methods that
define a new class and apply the decorator internally: RegisterSkill()
, RegisterStatusEffect()
, RegisterHoldableSkill()
.
- TypeScript
- Luau
attack.ts
import { Skill, SkillDecorator } from "@rbxts/wcs";
@SkillDecorator
export class Attack extends Skill {}
attack.lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local WCS = require(ReplicatedStorage.WCS)
local Attack = WCS.RegisterSkill("Attack")
return Attack