Rev 1608 | Rev 1610 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1608 | Rev 1609 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | 1 | ||
| - | 2 | function Console() { } |
|
| - | 3 | ||
| - | 4 | Console.autocomplete_callbacks = new Array(); |
|
| - | 5 | ||
| - | 6 | function Console_DoAutocomplete() |
|
| - | 7 | { |
|
| - | 8 | var name = arguments[0]; |
|
| - | 9 | ||
| - | 10 | //Log("Console_DoAutocomplete(), name=" + name); |
|
| - | 11 | ||
| - | 12 | var result = new Array(); |
|
| - | 13 | ||
| - | 14 | if (typeof Console.autocomplete_callbacks[name] != 'undefined') |
|
| - | 15 | { |
|
| - | 16 | //Log("calling autocomplete_callback"); |
|
| - | 17 | result = Console.autocomplete_callbacks[name](arguments); |
|
| - | 18 | } |
|
| - | 19 | ||
| - | 20 | var result_string = ""; |
|
| - | 21 | ||
| - | 22 | for (var n = 0; n < result.length; n++) |
|
| - | 23 | { |
|
| - | 24 | result_string += result[n] + "\n"; |
|
| - | 25 | } |
|
| - | 26 | ||
| - | 27 | return result_string; |
|
| - | 28 | } |
|
| - | 29 | ||
| 2 | function |
30 | function RegisterConsoleCommand(name, autocomplete_callback) |
| - | 31 | { |
|
| - | 32 | if (Console_RegisterConsoleCommand(name)) |
|
| - | 33 | { |
|
| - | 34 | if (autocomplete_callback) |
|
| 3 | { |
35 | { |
| - | 36 | Console.autocomplete_callbacks[name] = autocomplete_callback; |
|
| - | 37 | } |
|
| - | 38 | ||
| - | 39 | return true; |
|
| - | 40 | } |
|
| 4 | 41 | ||
| - | 42 | return false; |
|
| 5 | } |
43 | } |