forked from StrafesNET/strafe-client
52 lines
1.2 KiB
Lua
52 lines
1.2 KiB
Lua
|
type workspace = {[string]: {number}}
|
||
|
type Service = {}
|
||
|
|
||
|
export type exports = {[string]: {workspace | number | {}}}
|
||
|
|
||
|
local workspace: workspace = {}
|
||
|
local RS = {
|
||
|
RenderStepped = {},
|
||
|
Stepped = {},
|
||
|
Heartbeat = {}
|
||
|
}
|
||
|
local game = setmetatable({
|
||
|
Workspace = workspace,
|
||
|
Players = {},
|
||
|
RunService = RS
|
||
|
}, {
|
||
|
__index = function(self,i)
|
||
|
return rawget(self,i)
|
||
|
end,
|
||
|
__newindex = function(self,i,_)
|
||
|
--Roblox actually does this
|
||
|
local t = type(i)
|
||
|
return t == "Object" and "Unable to assign property Game. Property is read only" or `Unable to assign property Game. Object expected, got {t}`
|
||
|
end,
|
||
|
__metatable = "This metatable is locked."
|
||
|
})
|
||
|
|
||
|
function game:GetService(service: string): Service
|
||
|
return self[service]
|
||
|
end
|
||
|
function game:service(service: string): Service
|
||
|
return self:GetService(service)
|
||
|
end
|
||
|
function game:FindService(service: string): boolean | Service
|
||
|
return self[service] and self[service]
|
||
|
end
|
||
|
|
||
|
local tick = os.clock() --just be better (Roblox wants you to use this instead of "tick" anyways because of Wine)
|
||
|
local task = {
|
||
|
wait = {},
|
||
|
delay = {},
|
||
|
defer = {}
|
||
|
}
|
||
|
|
||
|
local exports: exports = {
|
||
|
game = game, Game = game,
|
||
|
workspace = workspace, Workspace = workspace,
|
||
|
tick = tick,
|
||
|
task = task
|
||
|
}
|
||
|
|
||
|
return exports
|