forked from StrafesNET/strafe-client
roblox sandbox maybe
This commit is contained in:
parent
e40e960ef2
commit
40745c4f6f
52
luau/tests/RobloxSandbox.lua
Normal file
52
luau/tests/RobloxSandbox.lua
Normal file
@ -0,0 +1,52 @@
|
||||
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
|
Loading…
Reference in New Issue
Block a user