Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local self = {}
- -- get the actual mod path right away!
- local testError = function()
- CreateProjectile("asdbfiosdjfaosdijcfiosdjsdo", 0, 0)
- end
- local _, output = xpcall(testError, debug.traceback)
- -- find the position of "Sprites/asdbfiosdjfaosdijcfiosdjsdo"
- local SpritesFolderPos = output:find("asdbfiosdjfaosdijcfiosdjsdo") - 10
- output = output:sub(1, SpritesFolderPos)
- -- get the full path to the mod file
- local path = output:sub(output:find("Attempted to load ") + 18)
- path = path:gsub("/", "\\")
- self.modPath = path
- -- get the name of the mod, too!
- -- find the position of the last slash in the file name
- local lastSlashIndex = 0
- for i = 1, #output do
- if output:sub(i, i) == "/" then
- lastSlashIndex = i
- end
- end
- -- get the name of the mod itself
- local folderName = output:sub(lastSlashIndex + 1, SpritesFolderPos)
- self.modName = folderName
- return self
Advertisement
Add Comment
Please, Sign In to add comment