AnotherFIreFox

Untitled

Feb 6th, 2023 (edited)
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. Comps = {}
  2. Comps.Powers = {}
  3.  
  4.   function Set(value, CompName)
  5.     local compList = Comps
  6.  
  7.     for _, v in pairs(CompName) do
  8.         print(_)
  9.       if compList[v] then
  10.       else
  11.         compList[v] = {}
  12.       end
  13.       print("New: " .. tostring(compList[v]))
  14.       compList = compList[v]
  15.       print("Set: " .. tostring(compList))
  16.     end
  17.  
  18.     -- at this point, compList is equal to Comps.Powers.Test.DeepTest
  19.     compList = value -- this makes compList different from Comps.Powers.test.DeepTest
  20.     print(compList)
  21.     print(compList.internalName)
  22.  
  23.   end
  24.  
  25.   hey = {"Powers", "Test", "DeepTest"}
  26.   bound = {internalName = "Hey", isBound = true}
  27.  
  28.   Set(bound, hey)
  29.  
  30.   print(Comps.Powers)
  31.   print(Comps.Powers.Test)
  32.   print(Comps.Powers.Test.DeepTest)
  33.   print(Comps.Powers.Test.DeepTest.internalName)
Advertisement
Add Comment
Please, Sign In to add comment