| 210 | |
| 211 | |
| 212 | void fcall_set( lk::invoke_t &cxt ) |
| 213 | { |
| 214 | LK_DOC( "set", "Set an input variable's value. Issues a script error if the variable doesn't exist or there is data type error.", "(string:name, variant:value):none" ); |
| 215 | cxt.result().assign( 0.0 ); |
| 216 | wxString name = cxt.arg(0).as_string(); |
| 217 | if ( Case *c = CurrentCase() ) |
| 218 | { |
| 219 | wxString var_name; |
| 220 | size_t ndx_hybrid; |
| 221 | UpdateVarNameNdxHybrid(c, name, &var_name, &ndx_hybrid); |
| 222 | if ( VarValue *vv = c->Values(ndx_hybrid).Get( var_name ) ) |
| 223 | { |
| 224 | if ( vv->Read( cxt.arg(1), false ) ) |
| 225 | c->VariableChanged( var_name, ndx_hybrid ); |
| 226 | else |
| 227 | cxt.error( "data type mismatch attempting to set '" + name + "' (" + vv_strtypes[vv->Type()] + ") to " + cxt.arg(1).as_string() + " ("+ wxString(cxt.arg(1).typestr()) + ")" ); |
| 228 | } |
| 229 | else |
| 230 | cxt.error("variable '" + name + "' does not exist in the current case" ); |
| 231 | } |
| 232 | else cxt.error("no active case"); |
| 233 | } |
| 234 | |
| 235 | void fcall_get( lk::invoke_t &cxt ) |
| 236 | { |
nothing calls this directly
no test coverage detected