Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gsc.gd #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scripts/gsc.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ func _ready():
pass

# Get list of files
func get_file_list(path,extensions=[],include_ext=true):
static func get_file_list(path,extensions=[],include_ext=true):
var dir = Directory.new()
var output = []
if dir.open(path) == OK:
Expand All @@ -23,7 +23,7 @@ func get_file_list(path,extensions=[],include_ext=true):
return output

# Get list of directories
func get_dir_list(path):
static func get_dir_list(path):
var dir = Directory.new()
var output = []
if dir.open(path) == OK:
Expand All @@ -37,7 +37,7 @@ func get_dir_list(path):
return output

# Batch add items to OptionButton
func opt_add_items(node,items,selected=""):
static func opt_add_items(node,items,selected=""):
var i = 0
var sel_i = 0
for item in items:
Expand All @@ -48,15 +48,15 @@ func opt_add_items(node,items,selected=""):
node.select(sel_i)

# Get json
func read_json(file_path):
static func read_json(file_path):
var file = File.new()
file.open(file_path, File.READ)
var json = parse_json(file.get_as_text())
file.close()
return json

# check keys r
func has_keys(dict,keys):
static func has_keys(dict,keys):
var have = true
for key in keys:
if dict.has(key):
Expand All @@ -65,4 +65,4 @@ func has_keys(dict,keys):
have = false
if not have:
dict = {}
return dict
return dict