File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -333,6 +333,20 @@ void ScriptApiBase::setOriginFromTableRaw(int index, const char *fxn)
333
333
#endif
334
334
}
335
335
336
+ /*
337
+ * How ObjectRefs are handled in Lua:
338
+ * When an active object is created, an ObjectRef is created on the Lua side
339
+ * and stored in core.object_refs[id].
340
+ * Methods that require an ObjectRef to a certain object retrieve it from that
341
+ * table instead of creating their own.(*)
342
+ * When an active object is removed, the existing ObjectRef is invalidated
343
+ * using ::set_null() and removed from the core.object_refs table.
344
+ * (*) An exception to this are NULL ObjectRefs and anonymous ObjectRefs
345
+ * for objects without ID.
346
+ * It's unclear what the latter are needed for and their use is problematic
347
+ * since we lose control over the ref and the contained pointer.
348
+ */
349
+
336
350
void ScriptApiBase::addObjectReference (ServerActiveObject *cobj)
337
351
{
338
352
SCRIPTAPI_PRECHECKHEADER
You can’t perform that action at this time.
0 commit comments