Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Explained
- local dir_string = 'Pan.Tilt.Mesh'
- local dir_tab = {}
- for x in dir_string:gmatch('[^.]+') do -- ^. meaning not . and + meaning until interupted by .
- table.insert(dir_tab) -- add the string to the table
- end
- -- dir_tab is now {'Pan','Tilt','Mesh'}
- -- it essentially does the opposite as table.concat(dir_tab, '.')
- local d = workspaceb -- Set the starting location
- for k, v in pairs({'Pan','Tilt','Mesh'}) -- The gmatch pattern essentially seperates it into the table specified in pairs()
- d = d[v] -- set current location to the child with the name v of current location
- end
- print(d:GetFullName()) -- > game.Workspace.Pan.Tilt.Mesh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement