Posted
so some wierdo mod deleted my getconnections test script so im gonna release that again with my debug lib test script
debug lib test:
local Results = {
debug = false,
getupvalues = false,
getupvalue = false,
setupvalue = false,
getconstants = false,
getconstant = false,
setconstant = false,
getprotos = false,
getproto = false,
setproto = false,
getinfo = false
}
local upvalue1 = "aa"
local upvalue2 = "bb"
local variable = nil
function upvaltest(a,b)
variable = upvalue1 .. upvalue2
end
function constanttest()
variable = "test1"
variable = "test2"
end
function prototest()
local function a()
return "proto1";
end
local function b()
return "proto2";
end
end
local s,e = pcall(function()
if debug then
Results["debug"] = true
if debug.getupvalues then
for i,v in next, debug.getupvalues(upvaltest) do
if v == "aa" then
Results["getupvalues"] = true
end
end
end
if debug.getupvalue then
if debug.getupvalue(upvaltest, 2) == "aa" then
Results["getupvalue"] = true
end
end
if debug.setupvalue then
debug.setupvalue(upvaltest, 2, "cc")
upvaltest()
if variable == "ccbb" then
Results["setupvalue"] = true
end
variable = nil
end
if debug.getconstants then
local consts = debug.getconstants(constanttest);
if consts[1] == "test1" and consts[2] == "test2" then
Results["getconstants"] = true
end
end
if debug.getconstant then
if debug.getconstant(constanttest, 2) == "test2" then
Results["getconstant"] = true
end
end
if debug.setconstant then
debug.setconstant(constanttest, 2, "test3")
constanttest()
if variable == "test3" then
Results["setconstant"] = true
end
variable = nil
end
if debug.getprotos then
if (debug.getprotos(prototest)[1]()) == "proto1" then
Results["getprotos"] = true
end
end
if debug.getproto then
if (debug.getproto(prototest, 2)()) == "proto2" then
Results["getproto"] = true
end
end
if debug.setproto then
debug.setproto(prototest, 2, function() return "proto3" end)
if (debug.getproto(prototest, 2)()) == "proto3" then
Results["setproto"] = true
end
end
if debug.getinfo then
local info = debug.getinfo(upvaltest)
if info["nups"] == 3 and info["what"] == "Lua" and info["numparams"] == 2 then
Results["getinfo"] = true
end
end
end
end)
if s then
for idx, val in next, Results do
if val == true then
print(idx,val)
else
warn(idx, val)
end
end
else
warn("an error has occured during the test: ", e)
end
getconnections test:
local Results = {
getconnections = false,
Function = false,
Enable = false,
Disable = false,
Fire = false,
Success = false
}
if getgenv().getconnections then
Results["getconnections"] = true
local variable = nil
function Connection1(prop)
variable = prop
end
local TestPart = Instance.new("Part")
TestPart.Changed:Connect(Connection1)
Results["Success"] = pcall(function()
local getcon = getconnections(TestPart.Changed)
if getcon[1] then
if getcon[1].Function == Connection1 then
Results["Function"] = true
end
if getcon[1].Fire then
getcon[1]:Fire("testfire")
if variable == "testfire" then
Results["Fire"] = true;
end
end
if getcon[1].Disable then
getcon[1]:Disable()
TestPart.Name = tostring(math.random())
if variable ~= "Name" then
Results["Disable"] = true;
end
end
if getcon[1].Enable then
getcon[1]:Enable()
TestPart.Name = tostring(math.random())
if variable == "Name" then
Results["Enable"] = true;
end
end
else
getconnections = false
end
end)
end
if Results["Success"] then
if Results["getconnections"] then
print("getconnections", Results["getconnections"])
print(".Function", Results["Function"])
print(":Enable", Results["Enable"])
print(":Disable", Results["Disable"])
print(":Fire", Results["Fire"])
else
warn("getconnections isn't present or isn't functioning properly.")
end
else
warn("An error has occured in the test")
endhttps://cdn.discordapp.com/attachments/1007601850402480158/1012351544798224424/littlekillermania.jpg
Replied
TEST
script
Cancel
Post
JustMarie#0709
Â
Replied
Since I dont do a lot of lua and am more of a js person I love the fact on how if you make a table its practically the same
const testtable = [
"number1",
"number2"
];Cancel
Post
no
Error: The signature must be between 3-200 characters
Replied
Vouch, I really needed this
Cancel
Post
| Discord (Updated): apppon#8358 | C++ Enthusiast |Â
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post