godot-shooter / change-html-template / files / Utils.gd
Branch change-html-template · default branch · all branches
Utils.gd
| 1 | # Note: `tool` is optional but without it there are no error reporting in the editor |
| 2 | tool |
| 3 | |
| 4 | static func log(arg1 = null, arg2 = null, arg3 = null, arg4 = null, arg5 = null, arg6 = null, arg7 = null, arg8 = null, arg9 = null): |
| 5 | var text = "" |
| 6 | var now = Time.get_datetime_string_from_system(false, true) |
| 7 | text += now |
| 8 | text += "> " |
| 9 | for argument in [arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9]: |
| 10 | if argument != null: |
| 11 | var argText = "%s " % argument |
| 12 | text += argText |
| 13 | print(text) |
| 14 | |
| 15 | static func filter(filter_function: FuncRef, candidate_array: Array)->Array: |
| 16 | var filtered_array := [] |
| 17 | |
| 18 | for candidate_value in candidate_array: |
| 19 | if filter_function.call_func(candidate_value): |
| 20 | filtered_array.append(candidate_value) |
| 21 | |
| 22 | return filtered_array |