Advertisement
ProjectCryptid

thingi

Aug 20th, 2020 (edited)
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.79 KB | None | 0 0
  1. local myfunc = Value
  2. local myfuncnumber = Value2
  3. local locate = function(name)
  4. local t = {}
  5. for _, v in pairs(getgc()) do
  6. if type(v) == "function" and not is_synapse_function(v) then
  7. if getinfo(v).name == name then
  8. t[#t+1]=v
  9. end
  10. end
  11. end
  12. return t;
  13. end
  14.  
  15. -- this is a modified function I'm working on.
  16. local defaultSettings = {
  17. pretty = true;
  18. robloxFullName = true;
  19. robloxProperFullName = true;
  20. robloxClassName = true;
  21. sortKeys = true;
  22. }
  23.  
  24. local function isLuaIdentifier(str)
  25. if type(str) ~= "string" then return false end
  26. -- must be nonempty
  27. if str:len() == 0 then return false end
  28. -- can only contain a-z, A-Z, 0-9 and underscore
  29. if str:find("[^%d%a_]") then return false end
  30. -- cannot begin with digit
  31. if tonumber(str:sub(1, 1)) then return false end
  32. return true
  33. end
  34.  
  35. -- works like Instance:GetFullName(), but invalid Lua identifiers are fixed (e.g. workspace["The Dude"].Humanoid)
  36. local function properFullName(object, usePeriod)
  37. if object == nil or object == game then return "" end
  38.  
  39. local s = object.Name
  40. local usePeriod = true
  41. if not isLuaIdentifier(s) then
  42. s = ("[%q]"):format(s)
  43. usePeriod = false
  44. end
  45.  
  46. if not object.Parent or object.Parent == game then
  47. return s
  48. else
  49. return properFullName(object.Parent) .. (usePeriod and "." or "") .. s
  50. end
  51. end
  52.  
  53. local depth = 0
  54. local shown
  55. local INDENT
  56. local jsonSettings
  57. local typeof = typeof;
  58.  
  59. local function json(value, jsonSettings)
  60. jsonSettings = jsonSettings or defaultSettings
  61. INDENT = "\t"
  62.  
  63. local v = value --args[1]
  64. local tabs = INDENT:rep(depth)
  65.  
  66. if depth == 0 then
  67. shown = {}
  68. end
  69. if type(v) == "string" then
  70. return ("%q"):format(v)
  71. elseif type(v) == "number" then
  72. if v == math.huge then return "Math.huge" end
  73. if v == -math.huge then return "-Math.huge" end
  74. return tonumber(v)
  75. elseif type(v) == "boolean" then
  76. return tostring(v)
  77. elseif type(v) == "nil" then
  78. return nil
  79. elseif type(v) == "table" and type(v.__tostring) == "function" then
  80. return tostring(v.__tostring(v))
  81. elseif type(v) == "table" and getmetatable(v) and type(getmetatable(v).__tostring) == "function" then
  82. return tostring(getmetatable(v).__tostring(v))
  83. elseif type(v) == "table" then
  84. if shown[v] then return "CYCLIC" end
  85. shown[v] = true
  86. local str = "Table({" .. (jsonSettings.pretty and ("\n" .. INDENT .. tabs) or "")
  87. local isArray = true
  88. for k, v in pairs(v) do
  89. if type(k) ~= "number" then
  90. isArray = false
  91. break
  92. end
  93. end
  94. if isArray then
  95. for i = 1, #v do
  96. if i ~= 1 then
  97. str = str .. "," .. (jsonSettings.pretty and ("\n" .. INDENT .. tabs) or " ")
  98. end
  99. depth = depth + 1
  100. str = str .. i .. ":" .. json(v[i], jsonSettings)
  101. depth = depth - 1
  102. end
  103. else
  104. local keyOrder = {}
  105. local keyValueStrings = {}
  106. for k, v in pairs(v) do
  107. depth = depth + 1
  108. local kStr = isLuaIdentifier(k) and k or ("" .. json(k, jsonSettings) .. "")
  109. local vStr = json(v, jsonSettings)
  110. --[[str = str .. ("%s = %s"):format(
  111. isLuaIdentifier(k) and k or ("[" .. json(k, jsonSettings) .. "]"),
  112. json(v, jsonSettings)
  113. )]]
  114. table.insert(keyOrder, kStr)
  115. keyValueStrings[kStr] = vStr
  116. depth = depth - 1
  117. end
  118. if jsonSettings.sortKeys then table.sort(keyOrder) end
  119. local first = true
  120. for _, kStr in pairs(keyOrder) do
  121. if not first then
  122. str = str .. "," .. (jsonSettings.pretty and ("\n" .. INDENT .. tabs) or " ")
  123. end
  124. str = str .. ("%s : %s"):format(kStr, keyValueStrings[kStr])
  125. first = false
  126. end
  127. end
  128. shown[v] = false
  129. if jsonSettings.pretty then
  130. str = str .. "\n" .. tabs
  131. end
  132. str = str .. "}, " .. ({ tostring(v):gsub("table: ", "") })[1] .. ")"
  133. return str
  134. elseif typeof then
  135. -- Check Roblox types
  136. if typeof(v) == "Instance" then
  137. return "Instance(\"" .. (jsonSettings.robloxFullName
  138. and (jsonSettings.robloxProperFullName and properFullName(v) or v:GetFullName())
  139. or v.Name) .. (jsonSettings.robloxClassName and (("\", %s"):format(v.ClassName)) or "") .. ")"
  140. elseif typeof(v) == "Axes" then
  141. local s = {}
  142. if v.X then table.insert(s, json(Enum.Axis.X, jsonSettings)) end
  143. if v.Y then table.insert(s, json(Enum.Axis.Y, jsonSettings)) end
  144. if v.Z then table.insert(s, json(Enum.Axis.Z, jsonSettings)) end
  145. return ("Axes(%s)"):format(table.concat(s, ", "))
  146. elseif typeof(v) == "BrickColor" then
  147. return ("BrickColor(%q)"):format(v.Name)
  148. elseif typeof(v) == "CFrame" then
  149. return ("CFrame(%s)"):format(table.concat({v:GetComponents()}, ", "))
  150. elseif typeof(v) == "Color3" then
  151. return ("Color3(%d, %d, %d)"):format(v.r, v.g, v.b)
  152. elseif typeof(v) == "ColorSequence" then
  153. if #v.Keypoints > 2 then
  154. return ("ColorSequence(%s)"):format(json(v.Keypoints, jsonSettings))
  155. else
  156. if v.Keypoints[1].Value == v.Keypoints[2].Value then
  157. return ("ColorSequence(%s)"):format(json(v.Keypoints[1].Value, jsonSettings))
  158. else
  159. return ("ColorSequence(%s, %s)"):format(
  160. json(v.Keypoints[1].Value, jsonSettings),
  161. json(v.Keypoints[2].Value, jsonSettings)
  162. )
  163. end
  164. end
  165. elseif typeof(v) == "ColorSequenceKeypoint" then
  166. return ("ColorSequenceKeypoint(%d, %s)"):format(v.Time, json(v.Value, jsonSettings))
  167. elseif typeof(v) == "DockWidgetPluginGuiInfo" then
  168. return ("DockWidgetPluginGuiInfo(%s, %s, %s, %s, %s, %s, %s)"):format(
  169. json(v.InitialDockState, jsonSettings),
  170. json(v.InitialEnabled, jsonSettings),
  171. json(v.InitialEnabledShouldOverrideRestore, jsonSettings),
  172. json(v.FloatingXSize, jsonSettings),
  173. json(v.FloatingYSize, jsonSettings),
  174. json(v.MinWidth, jsonSettings),
  175. json(v.MinHeight, jsonSettings)
  176. )
  177. elseif typeof(v) == "Enums" then
  178. return "Enums"
  179. elseif typeof(v) == "Enum" then
  180. return ("Enum.%s"):format(tostring(v))
  181. elseif typeof(v) == "EnumItem" then
  182. return ("Enum.%s.%s"):format(tostring(v.EnumType), v.Name)
  183. elseif typeof(v) == "Faces" then
  184. local s = {}
  185. for _, enumItem in pairs(Enum.NormalId:GetEnumItems()) do
  186. if v[enumItem.Name] then
  187. table.insert(s, json(enumItem, jsonSettings))
  188. end
  189. end
  190. return ("Faces(%s)"):format(table.concat(s, ", "))
  191. elseif typeof(v) == "NumberRange" then
  192. if v.Min == v.Max then
  193. return ("NumberRange(%d)"):format(v.Min)
  194. else
  195. return ("NumberRange(%d, %d)"):format(v.Min, v.Max)
  196. end
  197. elseif typeof(v) == "NumberSequence" then
  198. if #v.Keypoints > 2 then
  199. return ("NumberSequence(%s)"):format(json(v.Keypoints, jsonSettings))
  200. else
  201. if v.Keypoints[1].Value == v.Keypoints[2].Value then
  202. return ("NumberSequence(%d)"):format(v.Keypoints[1].Value)
  203. else
  204. return ("NumberSequence(%d, %d)"):format(v.Keypoints[1].Value, v.Keypoints[2].Value)
  205. end
  206. end
  207. elseif typeof(v) == "NumberSequenceKeypoint" then
  208. if v.Envelope ~= 0 then
  209. return ("NumberSequenceKeypoint(%d, %d, %d)"):format(v.Time, v.Value, v.Envelope)
  210. else
  211. return ("NumberSequenceKeypoint(%d, %d)"):format(v.Time, v.Value)
  212. end
  213. elseif typeof(v) == "PathWaypoint" then
  214. return ("PathWaypoint(%s, %s)"):format(
  215. json(v.Position, jsonSettings),
  216. json(v.Action, jsonSettings)
  217. )
  218. elseif typeof(v) == "PhysicalProperties" then
  219. return ("PhysicalProperties(%d, %d, %d, %d, %d)"):format(
  220. v.Density, v.Friction, v.Elasticity, v.FrictionWeight, v.ElasticityWeight
  221. )
  222. elseif typeof(v) == "Random" then
  223. return "random()"
  224. elseif typeof(v) == "Ray" then
  225. return ("Ray(%s, %s)"):format(
  226. json(v.Origin, jsonSettings),
  227. json(v.Direction, jsonSettings)
  228. )
  229. elseif typeof(v) == "RBXScriptConnection" then
  230. return "ScriptConnection()"
  231. elseif typeof(v) == "RBXScriptSignal" then
  232. return "ScriptSignal()"
  233. elseif typeof(v) == "Rect" then
  234. return ("Rect(%d, %d, %d, %d)"):format(
  235. v.Min.X, v.Min.Y, v.Max.X, v.Max.Y
  236. )
  237. elseif typeof(v) == "Region3" then
  238. local min = v.CFrame.p + v.Size * -.5
  239. local max = v.CFrame.p + v.Size * .5
  240. return ("Region3(%s, %s)"):format(
  241. json(min, jsonSettings),
  242. json(max, jsonSettings)
  243. )
  244. elseif typeof(v) == "Region3int16" then
  245. return ("Region3int16(%s, %s)"):format(
  246. json(v.Min, jsonSettings),
  247. json(v.Max, jsonSettings)
  248. )
  249. elseif typeof(v) == "TweenInfo" then
  250. return ("TweenInfo(%d, %s, %s, %d, %s, %d)"):format(
  251. v.Time, json(v.EasingStyle, jsonSettings), json(v.EasingDirection, jsonSettings),
  252. v.RepeatCount, json(v.Reverses, jsonSettings), v.DelayTime
  253. )
  254. elseif typeof(v) == "UDim" then
  255. return ("UDim(%d, %d)"):format(
  256. v.Scale, v.Offset
  257. )
  258. elseif typeof(v) == "UDim2" then
  259. return ("UDim2(%d, %d, %d, %d)"):format(
  260. v.X.Scale, v.X.Offset, v.Y.Scale, v.Y.Offset
  261. )
  262. elseif typeof(v) == "Vector2" then
  263. return ("Vector2(%d, %d"):format(v.X, v.Y)
  264. elseif typeof(v) == "Vector2int16" then
  265. return ("Vector2int16(%d, %d)"):format(v.X, v.Y)
  266. elseif typeof(v) == "Vector3" then
  267. return ("Vector3(%d, %d, %d)"):format(v.X, v.Y, v.Z)
  268. elseif typeof(v) == "Vector3int16" then
  269. return ("Vector3int16(%d, %d, %d)"):format(v.X, v.Y, v.Z)
  270. else
  271. if type(v) == "function" then
  272. return "funct(\"" .. getinfo(v).name .."\"," .. ({ tostring(v):gsub("function: ", "") })[1] .. ")"
  273. end
  274. return typeof(v)
  275. end
  276. else
  277. return type(v)
  278. end
  279. end
  280.  
  281. local function Env_Dump(func)
  282. local tab = {
  283. upvalues=getupvalues(func),
  284. constants=getconstants(func),
  285. protos=getprotos(func),
  286. fenv = getfenv(func)
  287. }
  288. rconsoleprint("DUMP\n")
  289. rconsoleprint(json(getinfo(func)) .. "\n\n")
  290. rconsoleprint(json(tab) .. "\n")
  291. rconsoleprint("END\n")
  292. end
  293.  
  294. local func_wanted= locate(myfunc)[myfuncnumber]; -- remember this is a table
  295. Env_Dump(func_wanted)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement