| 197 | } |
| 198 | |
| 199 | void AddVariable(asIScriptEngine *engine, string &arg) |
| 200 | { |
| 201 | asIScriptModule *mod = engine->GetModule("console", asGM_CREATE_IF_NOT_EXISTS); |
| 202 | |
| 203 | // Add a semi-colon to end the statement (if not already there) |
| 204 | if( arg.length() > 0 && arg[arg.length()-1] != ';' ) |
| 205 | arg += ";"; |
| 206 | |
| 207 | int r = mod->CompileGlobalVar("addvar", arg.c_str(), 0); |
| 208 | if( r < 0 ) |
| 209 | { |
| 210 | // TODO: Add better description of error (invalid declaration, name conflict, etc) |
| 211 | cout << "Failed to add variable. " << endl; |
| 212 | } |
| 213 | else |
| 214 | cout << "Variable added. " << endl; |
| 215 | } |
| 216 | |
| 217 | void DeleteVariable(asIScriptEngine *engine, string &arg) |
| 218 | { |
no test coverage detected