| 205 | } |
| 206 | |
| 207 | JSValue ScObjectManager::getObject(JSContext* ctx, JSValue thisVal, int argc, JSValue* argv) |
| 208 | { |
| 209 | JS_UNPACK_STR(typez, ctx, argv[0]); |
| 210 | JS_UNPACK_INT32(index, ctx, argv[1]); |
| 211 | auto& objManager = GetContext()->GetObjectManager(); |
| 212 | |
| 213 | auto type = objectTypeFromString(typez); |
| 214 | if (type != ObjectType::none) |
| 215 | { |
| 216 | auto obj = objManager.GetLoadedObject(type, index); |
| 217 | if (obj != nullptr) |
| 218 | { |
| 219 | return CreateScObject(ctx, type, index); |
| 220 | } |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | return JS_ThrowPlainError(ctx, "Invalid object type."); |
| 225 | } |
| 226 | return JS_NULL; |
| 227 | } |
| 228 | |
| 229 | JSValue ScObjectManager::getAllObjects(JSContext* ctx, JSValue thisVal, int argc, JSValue* argv) |
| 230 | { |
nothing calls this directly
no test coverage detected