Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
kurzyxPublic archive

About

Glob for Garry's mod

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Glob for Garry's mod

Match files using the patterns the shell uses, like stars and stuff.

Inspiration comes from: https://github.com/isaacs/node-glob

Usage

The following characters have special magic meaning when used in a path portion:

  • * Matches 0 or more characters in a single path portion
  • ? Matches 1 character
  • [...] Matches a range of characters, similar to a RegExp range. If the first character of the range is ! or ^ then it matches any character not in the range.
  • ** If a "globstar" is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches.

The following may be added at a later date:

  • !(pattern|pattern|pattern) Matches anything that does not match any of the patterns provided.
  • ?(pattern|pattern|pattern) Matches zero or one occurrence of the patterns provided.
  • +(pattern|pattern|pattern) Matches one or more occurrences of the patterns provided.
  • *(a|b|c) Matches zero or more occurrences of the patterns provided
  • @(pattern|pat*|pat?erN) Matches exactly one of the patterns provided

Examples

Example 1

Find all configuration files.

File structure:

addons/lua/my-addon
.
├── config
│   ├── module1
│   │   ├── something.lua
│   │   ├── else.lua
│   ├── module2
│   │   ├── something.lua
│   │   ├── sub
│   │   │   ├── else.lua

How you would use the glob functionality:

local result = Glob.glob('LUA', '**/*.lua', 'my-addon/config', 'file')

result:

{
    'module1/something.lua',
    'module1/else.lua',
    'module2/something.lua',
    'module2/sub/else.lua',
}

About

Glob for Garry's mod

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages