코드 샘플
간단한 모듈 스크립트 예시
-- 테이블은 하나의 변수에 여러 값을 저장합니다
local MyFunctions = {}
-- 테이블에 몇 가지 함수 추가
function MyFunctions.foo()
print("Foo!")
end
function MyFunctions.bar()
print("Bar!")
end
-- ModuleScripts는 정확히 하나의 값을 반환해야 합니다
return MyFunctions
Simple ModuleScript Usage
-- The require function is provided a ModuleScript, then runs
-- the code, waiting until it returns a singular value.
local MyFunctions = require(script.Parent.MyFunctions)
-- These are some dummy functions defined in another code sample
MyFunctions.foo()
MyFunctions.bar()