You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (model != nullptr && submodel_num < model->n_models)
60
+
returntrue;
61
61
}
62
62
returnfalse;
63
63
}
64
64
65
65
66
+
ADE_FUNC(__eq, l_Model, "model, model", "Checks if two model handles refer to the same model", "boolean", "True if models are equal")
67
+
{
68
+
model_h* mdl1;
69
+
model_h* mdl2;
70
+
71
+
if (!ade_get_args(L, "oo", l_Model.GetPtr(&mdl1), l_Model.GetPtr(&mdl2)))
72
+
returnADE_RETURN_NIL;
73
+
74
+
if (mdl1->GetID() == mdl2->GetID())
75
+
returnADE_RETURN_TRUE;
76
+
77
+
returnADE_RETURN_FALSE;
78
+
}
79
+
80
+
ADE_FUNC(__eq, l_Submodel, "submodel, submodel", "Checks if two submodel handles refer to the same submodel", "boolean", "True if submodels are equal")
81
+
{
82
+
submodel_h* smh1;
83
+
submodel_h* smh2;
84
+
85
+
if (!ade_get_args(L, "oo", l_Submodel.GetPtr(&smh1), l_Submodel.GetPtr(&smh2)))
86
+
returnADE_RETURN_NIL;
87
+
88
+
if (smh1->GetModelID() == smh2->GetModelID() && smh1->GetSubmodelIndex() == smh2->GetSubmodelIndex())
89
+
returnADE_RETURN_TRUE;
90
+
91
+
returnADE_RETURN_FALSE;
92
+
}
93
+
66
94
ADE_VIRTVAR(Submodels, l_Model, nullptr, "Model submodels", "submodels", "Model submodels, or an invalid submodels handle if the model handle is invalid")
if (pm != nullptr && _submodel_num < pm->n_models)
192
+
returntrue;
193
+
}
194
+
}
195
+
returnfalse;
196
+
}
197
+
198
+
199
+
ADE_FUNC(__eq, l_ModelInstance, "model_instance, model_instance", "Checks if two model instance handles refer to the same model instance", "boolean", "True if model instances are equal")
200
+
{
201
+
modelinstance_h* mih1;
202
+
modelinstance_h* mih2;
203
+
204
+
if (!ade_get_args(L, "oo", l_ModelInstance.GetPtr(&mih1), l_ModelInstance.GetPtr(&mih2)))
205
+
returnADE_RETURN_NIL;
206
+
207
+
if (mih1->GetID() == mih2->GetID())
208
+
returnADE_RETURN_TRUE;
209
+
210
+
returnADE_RETURN_FALSE;
171
211
}
172
212
213
+
ADE_FUNC(__eq, l_SubmodelInstance, "submodel_instance, submodel_instance", "Checks if two submodel instance handles refer to the same submodel instance", "boolean", "True if submodel instances are equal")
214
+
{
215
+
submodelinstance_h* smih1;
216
+
submodelinstance_h* smih2;
217
+
218
+
if (!ade_get_args(L, "oo", l_SubmodelInstance.GetPtr(&smih1), l_SubmodelInstance.GetPtr(&smih2)))
219
+
returnADE_RETURN_NIL;
220
+
221
+
if (smih1->GetModelInstanceID() == smih2->GetModelInstanceID() && smih1->GetSubmodelIndex() == smih2->GetSubmodelIndex())
222
+
returnADE_RETURN_TRUE;
223
+
224
+
returnADE_RETURN_FALSE;
225
+
}
173
226
174
227
ADE_FUNC(getModel, l_ModelInstance, nullptr, "Returns the model used by this instance", "model", "A model")
//Since the first element of a list is the next element from the head, and we start this function with the captured "ss" object being the head, this GET_NEXT will return the first element on first call of this lambda.
116
+
//Similarly, an empty list is defined by the head's next element being itself, hence an empty list will immediately return nil just fine
117
+
ss = GET_NEXT(ss);
118
+
119
+
if (ss == END_OF_LIST(&shipp->subsys_list) || ss == nullptr) {
ADE_FUNC(setFlag, l_Ship, "boolean set_it, string flag_name", "Sets or clears one or more flags - this function can accept an arbitrary number of flag arguments. The flag names can be any string that the alter-ship-flag SEXP operator supports.", nullptr, "Returns nothing")
0 commit comments