| 40 // Tries to declare a new global-scope variable. Returns pointer |
40 // Tries to declare a new global-scope variable. Returns pointer |
| 41 // to new global variable, null if declaration failed. |
41 // to new global variable, null if declaration failed. |
| 42 script_variable* declare_global_variable (type_e type, string name) |
42 script_variable* declare_global_variable (type_e type, string name) |
| 43 { |
43 { |
| 44 // Unfortunately the VM does not support string variables so yeah. |
44 // Unfortunately the VM does not support string variables so yeah. |
| 45 if (type == TYPE_STRING) |
45 if (type == e_string_type) |
| 46 error ("variables cannot be string\n"); |
46 error ("variables cannot be string\n"); |
| 47 |
47 |
| 48 // Check that the variable is valid |
48 // Check that the variable is valid |
| 49 if (find_command_by_name (name)) |
49 if (find_command_by_name (name)) |
| 50 error ("name of variable-to-be `%s` conflicts with that of a command", name.chars()); |
50 error ("name of variable-to-be `%s` conflicts with that of a command", name.chars()); |