Pioneer
Loading...
Searching...
No Matches
LuaObject.h
Go to the documentation of this file.
1// Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3
4#ifndef _LUAOBJECT_H
5#define _LUAOBJECT_H
6
7#include "DeleteEmitter.h"
8#include "Lua.h"
9#include "LuaPushPull.h"
10#include "LuaRef.h"
11#include "LuaUtils.h"
12#include "LuaWrappable.h"
13#include "RefCounted.h"
14#include "galaxy/SystemPath.h"
15#include <tuple>
16#include <typeinfo>
17
18//
19// LuaObject provides proxy objects and tracking facilities to safely get
20// objects in and out of lua. the basic idea is that for every class you want
21// to expose to lua, you define LuaObject wrapper class that defines the
22// lua name lua name, methods and metamethods for that class. you then call
23// methods on this class to push and pull objects to and from the lua stack
24//
25// Push an object to the Lua stack:
26//
27// // C++-owned, still responsible for deletion
28// Ship *s = new Ship("wave");
29// LuaObject<Ship>::PushToLua(s);
30//
31// // RefCounted, Lua will take a reference
32// StarSystem *s = Pi::GetGalaxy()->GetStarSystem(SystemPath(0,0,0,0));
33// LuaObject<StarSystem>::PushToLua(s);
34//
35// // Stack-allocated, Lua will get a copy
36// SystemPath path(0,0,0,0,1);
37// LuaObject<SystemPath>::PushToLua(path);
38//
39// // Create an object, fully owned by lua
40// // WARNING! the lifetime of an object will be determined by the lua garbage
41// // collector, so a pointer to it should not be stored in any form on the C++ side
42// LuaObject<Ship>::CreateInLua(ship_id); // constructor arguments are passed
43//
44// Get an object from the Lua stack at index n. Causes a Lua exception if the
45// object doesn't exist or the types don't match.
46//
47// Ship *s = LuaObject<Ship>::CheckFromLua(1);
48//
49// Or alternatively, get it and return 0 on failure.
50//
51// Ship *s = LuaObject<Ship>::GetFromLua(1);
52//
53//
54// If you need to expose a new class to Lua:
55//
56// - Have it inherit from LuaWrappable
57//
58// - Have it either:
59// - inherit from DeleteEmitter
60// - inherit from RefCounted
61// - implement a copy constructor
62//
63// - Arrange for the wrapper class RegisterClass() method to be called in
64// LuaInit in Pi.cpp
65//
66// - Make a new file LuaWhatever.cpp implement RegisterClass() and any
67// methods, metamethods and attribute methods you want. Copy from one of the
68// other files to get the idea
69//
70// - Add the new file to the build system
71//
72
73// type for promotion test callbacks
74typedef bool (*PromotionTest)(LuaWrappable *o);
75
76/*
77 * SerializerPair stores object hooks for serializing and deserializing objects
78 * into and out of json. The serialization mechanism functions in a type-erased
79 * manner; the hook is responsible for loading the serialized object from the
80 * Lua stack and in turn pushing the deserialized object on the stack as well.
81 */
83 // Serializer takes a lua object on the top of the stack and writes it to `out`
84 using Serializer = bool (*)(lua_State *l, Json &out);
85 // Deserializer takes `obj` and creates a lua object on the top of the stack
86 using Deserializer = bool (*)(lua_State *l, const Json &obj);
87
89 serialize(nullptr),
90 deserialize(nullptr)
91 {}
92
93 SerializerPair(Serializer serialize_, Deserializer deserialize_) :
94 serialize(serialize_),
95 deserialize(deserialize_)
96 {}
97
100};
101
102class PropertyMap;
103class LuaMetaTypeBase;
104
105// wrapper baseclass, and extra bits for getting at certain parts of the
106// LuaObject layer
108 friend class LuaSerializer;
109
110public:
111 // creates a single "typeless" object and attaches the listed methods,
112 // attributes and metamethods to it. leaves the created object on the
113 // stack
114 static void CreateObject(const luaL_Reg *methods, const luaL_Reg *attrs, const luaL_Reg *meta, bool protect = false);
115
116 // Creates a single "typeless" object and attaches the given metatype
117 // to it. Leaves the created object on the stack.
118 static void CreateObject(LuaMetaTypeBase *metaType);
119
120 // Checks if the object at the stack position is a PropertiedObject and returns a pointer to
121 // its PropertyMap. Returns nullptr on failure.
122 static PropertyMap *GetPropertiesFromObject(lua_State *l, int object);
123
124 // register a serializer pair for a given type
125 static void RegisterSerializer(const char *type, SerializerPair pair);
126
127 // Serialize all lua components registered for the given object.
128 // Requires the LuaWrappable object to have been pushed to Lua at least once and still exist.
129 // LuaComponents are only valid for LuaCoreObjects (in practice, only Body descendants)
130 static bool SerializeComponents(LuaWrappable *object, Json &out);
131
132 // Deserialize all lua components saved for the given object
133 // Requires the LuaWrappable object to have been pushed to Lua at least once and still exist
134 // LuaComponents are only valid for LuaCoreObjects (in practice, only Body descendants)
135 static bool DeserializeComponents(LuaWrappable *object, const Json &obj);
136
137 // Lookup the given LuaWrappable-derived object and deregister it if present.
138 // Remove the object->wrapper from the registry. checks to make sure the
139 // the mapping matches first, to protect against memory being reused
140 // Transient (garbage-collected) LuaObjects should not be deregistered.
141 static void DeregisterObject(LuaWrappable *object);
142
143protected:
144 // base class constructor, called by the wrapper Push* methods
145 LuaObjectBase(const char *type) :
146 m_type(type){};
147 virtual ~LuaObjectBase() {}
148
149 // creates a class in the lua vm with the given name and attaches the
150 // listed methods to it and the listed metamethods to its metaclass. if
151 // attributes extra magic is added to the metaclass to make them work as
152 // expected
153 static void CreateClass(const char *type, const char *parent, const luaL_Reg *methods, const luaL_Reg *attrs, const luaL_Reg *meta);
154
155 // Creates a class in the lua vm with the given name and attaches the
156 // listed metatype to it. All method, attribute, and metamethod handling
157 // is contained in the metatype.
158 static void CreateClass(LuaMetaTypeBase *metaType);
159
160 // Push an already-registered object onto the lua stack. the object is
161 // looked up in the lua registry, if it exists its userdata is pushed
162 // onto the lua stack. Returns true if the object exists and was pushed,
163 // false otherwise
164 static bool PushRegistered(LuaWrappable *o);
165
166 // Adds an object->wrapper mapping to the registry for the given wrapper
167 // object. The wrapper's corresponding userdata should be on the top of
168 // the stack.
169 // This method registers the given userdata in the transient registry and
170 // the LuaObject will be garbage-collected if no reference is held in Lua.
171 // This should only be used for ref-counted pointers or lua-owned objects.
172 static void Register(LuaObjectBase *lo);
173
174 // Adds an object->wrapper mapping to the persistent registry for the
175 // given wrapper object (will never be garbage collected).
176 // The wrapper's corresponding userdata should be on the top of the
177 // stack.
178 static void RegisterPersistent(LuaObjectBase *lo);
179
180 // pulls an object off the lua stack and returns its associated c++
181 // object. type is the lua type string of the object. a lua exception is
182 // triggered if the object on the stack is not of this type
183 static LuaWrappable *CheckFromLua(int index, const char *type);
184
185 // does exactly the same as Check without triggering exceptions
186 static LuaWrappable *GetFromLua(int index, const char *type);
187
188 // register a promotion test. when an object with lua type base_type is
189 // pushed, test_fn will be called. if it returns true then the created lua
190 // object will be of target_type
191 static void RegisterPromotion(const char *base_type, const char *target_type, PromotionTest test_fn);
192
193 // Take a lua object at the top of the stack and serialize it to Json
194 static bool SerializeToJson(lua_State *l, Json &out);
195
196 // Take a json object and deserialize it to a lua object
197 static bool DeserializeFromJson(lua_State *l, const Json &obj);
198
199 // allocate n bytes from Lua memory and leave it an associated userdata on
200 // the stack. this is a wrapper around lua_newuserdata
201 static void *Allocate(size_t n);
202
203 // allocate uninitialized memory for an object of type T and leave it as an
204 // associated userdata on the stack.
205 template <typename T>
206 static T *Allocate() { return static_cast<T *>(Allocate(sizeof(T))); }
207
208 template <typename T, typename... Args>
209 static T *AllocateNew(Args &&...args) { return new (Allocate<T>()) T(std::forward<Args>(args)...); }
210
211 // get a pointer to the underlying object
212 virtual LuaWrappable *GetObject() const = 0;
213
214 // clear the underlying object pointer (turn this LuaObject into an "orphan" object)
215 virtual void ClearObject() {}
216
217 const char *GetType() const { return m_type; }
218
219private:
220 LuaObjectBase() {}
221 LuaObjectBase(const LuaObjectBase &) {}
222
223 // Lua-side helper functionality, declared in LuaObject.cpp
224 friend class LuaObjectHelpers;
225
226 // determine if the object has a class in its ancestry
227 bool Isa(const char *base) const;
228
229 // lua type (ie method/metatable name)
230 const char *m_type;
231};
232
233// templated portion of the wrapper baseclass
234template <typename T>
235class LuaObject : public LuaObjectBase {
236public:
237 // registers the class with the lua vm
238 static void RegisterClass();
239
240 // wrap an object and push it onto the stack. these create a wrapper
241 // object that knows how to deal with the type of object
242 static inline void PushToLua(DeleteEmitter *o); // LuaCoreObject
243 static inline void PushToLua(RefCounted *o); // LuaSharedObject
244 static inline void PushToLua(const T &o); // LuaCopyObject
245 static inline void PushComponentToLua(LuaWrappable *o); // LuaComponentObject
246 template <typename... Args>
247 static inline void CreateInLua(Args &&...args);
248
249 template <typename Ret, typename Key, typename... Args>
250 static inline Ret CallMethod(T *o, const Key &key, const Args &...args);
251 template <typename Key, typename... Args>
252 static inline void CallMethod(T *o, const Key &key, const Args &...args)
253 {
254 CallMethod<bool>(o, key, args...);
255 }
256
257 template <typename Ret1, typename Ret2, typename... Ret, typename Key, typename... Args>
258 static inline std::tuple<Ret1, Ret2, Ret...> CallMethod(T *o, const Key &key, const Args &...args);
259
260 // pull an object off the stack, unwrap and return it
261 // if not found or doesn't match the type, throws a lua exception
262 static inline T *CheckFromLua(int idx)
263 {
264#ifdef __clang__
265#pragma clang diagnostic push
266#pragma clang diagnostic ignored "-Wundefined-var-template"
267#endif
268 return dynamic_cast<T *>(LuaObjectBase::CheckFromLua(idx, s_type));
269#ifdef __clang__
270#pragma clang diagnostic pop
271#endif
272 }
273
274 // same but without error checks. returns 0 on failure
275 static inline T *GetFromLua(int idx)
276 {
277#ifdef __clang__
278#pragma clang diagnostic push
279#pragma clang diagnostic ignored "-Wundefined-var-template"
280#endif
281 return dynamic_cast<T *>(LuaObjectBase::GetFromLua(idx, s_type));
282#ifdef __clang__
283#pragma clang diagnostic pop
284#endif
285 }
286
287 // standard cast promotion test for convenience
289 {
290 return dynamic_cast<T *>(o);
291 }
292
293protected:
294#ifdef __clang__
295#pragma clang diagnostic push
296#pragma clang diagnostic ignored "-Wundefined-var-template"
297#endif
299 LuaObjectBase(s_type)
300 {}
301#ifdef __clang__
302#pragma clang diagnostic pop
303#endif
304
305private:
306 // initial lua type string. defined in a specialisation in the appropriate
307 // .cpp file
308 static const char *s_type;
309};
310
311// wrapper for a "core" object - one owned by c++ (eg Body).
312// Lua needs to know when the object is deleted so that it can handle
313// requests for it appropriately (ie with an exception, or exists())
314// CoreObject pointers will be registered in the persistent registry and never
315// garbage-collected while the referenced object is still alive.
316template <typename T>
317class LuaCoreObject : public LuaObject<T> {
318public:
320 m_object(o)
321 {
322 m_deleteConnection = m_object->DeleteEmitter::onDelete.connect(sigc::mem_fun(this, &LuaCoreObject::OnDelete));
323 }
324
326 {
327 if (m_deleteConnection.connected())
328 m_deleteConnection.disconnect();
329 }
330
331 LuaWrappable *GetObject() const override
332 {
333 return m_object;
334 }
335
336 void ClearObject() override
337 {
338 if (m_deleteConnection.connected())
339 m_deleteConnection.disconnect();
340
341 m_object = 0;
342 }
343
344private:
345 void OnDelete()
346 {
348 m_object = 0;
349 }
350
351 T *m_object;
352 sigc::connection m_deleteConnection;
353};
354
355// Wrapper type for BodyComponent handles - deletion of components is handled
356// in a callback from the BodyComponentDB. Component handles will be registered
357// in the persistent registry and never garbage-collected while the component
358// remains alive.
359template<typename T>
360class LuaComponentObject final : public LuaObject<T> {
361public:
363 m_object(o)
364 {
365 }
366
367 LuaWrappable *GetObject() const override
368 {
369 return m_object;
370 }
371
372 void ClearObject() override
373 {
374 m_object = nullptr;
375 }
376
377private:
378 T *m_object;
379};
380
381// wrapper for a "shared" object - one that can comfortably exist in both
382// environments. usually for long-lived (StarSystem) or standalone (UI
383// widget) objects
384// Lua simply needs to keep a reference to these
385template <typename T>
386class LuaSharedObject : public LuaObject<T> {
387public:
389 m_object(o) {}
390
391 LuaWrappable *GetObject() const override
392 {
393 return m_object.Get();
394 }
395
396private:
397 RefCountedPtr<T> m_object;
398};
399
400// wrapper for a "copied" object. a new one is created via the copy
401// constructor and fully owned by Lua. good for lightweight POD-style objects
402// (eg SystemPath)
403template <typename T>
404class LuaCopyObject : public LuaObject<T> {
405public:
406 LuaCopyObject(const T &o)
407 {
408 lua_State *l = Lua::manager->GetLuaState();
409 m_object = LuaObjectBase::AllocateNew<T>(o);
410 m_ref = LuaRef(l, -1);
411 lua_pop(l, 1);
412 }
413
415 {
416 m_object->~T();
417 m_object = 0;
418 }
419
420 LuaWrappable *GetObject() const override
421 {
422 return m_object;
423 }
424
425private:
426 T *m_object;
427 LuaRef m_ref;
428};
429
430// wrapper for a "lua-owned" object.
431// the wrapper is deleted by lua gc, and when it is deleted, it also deletes the wrapped object
432template <typename T>
433class LuaOwnObject : public LuaObject<T> {
434public:
436 {
437 m_object = o;
438 }
439
441 {
442 delete (m_object);
443 }
444
445 LuaWrappable *GetObject() const override
446 {
447 return m_object;
448 }
449
450private:
451 T *m_object;
452};
453
454// push methods, create wrappers if necessary
455// wrappers are allocated from Lua memory
456template <typename T>
458{
459 if (!PushRegistered(o))
460 RegisterPersistent(AllocateNew<LuaCoreObject<T>>(static_cast<T *>(o)));
461}
462
463template<typename T>
465{
466 if (!PushRegistered(o))
467 RegisterPersistent(AllocateNew<LuaComponentObject<T>>(static_cast<T *>(o)));
468}
469
470template <typename T>
472{
473 if (!PushRegistered(o))
474 Register(AllocateNew<LuaSharedObject<T>>(static_cast<T *>(o)));
475}
476
477template <typename T>
478inline void LuaObject<T>::PushToLua(const T &o)
479{
480 Register(AllocateNew<LuaCopyObject<T>>(o));
481}
482
483template <typename T>
484template <typename... Args>
485inline void LuaObject<T>::CreateInLua(Args &&...args)
486{
487 T *p(new T(std::forward<Args>(args)...));
488 Register(AllocateNew<LuaOwnObject<T>>(static_cast<T *>(p)));
489}
490
491template <typename T>
492template <typename Ret, typename Key, typename... Args>
493inline Ret LuaObject<T>::CallMethod(T *o, const Key &key, const Args &...args)
494{
495 lua_State *l = Lua::manager->GetLuaState();
497 Ret return_value;
498
499 lua_checkstack(l, sizeof...(args) + 5);
500 PushToLua(o);
501 pi_lua_generic_push(l, key);
502 lua_gettable(l, -2);
503 lua_pushvalue(l, -2);
504 lua_remove(l, -3);
505 pi_lua_multiple_push(l, args...);
506 pi_lua_protected_call(l, sizeof...(args) + 1, 1);
507 pi_lua_generic_pull(l, -1, return_value);
508 lua_pop(l, 1);
509 LUA_DEBUG_END(l, 0);
510 return return_value;
511}
512
513template <typename T>
514template <typename Ret1, typename Ret2, typename... Ret, typename Key, typename... Args>
515inline std::tuple<Ret1, Ret2, Ret...> LuaObject<T>::CallMethod(T *o, const Key &key, const Args &...args)
516{
517 lua_State *l = Lua::manager->GetLuaState();
518
520 lua_checkstack(l, sizeof...(args) + 5);
521 PushToLua(o);
522 pi_lua_generic_push(l, key);
523 lua_gettable(l, -2);
524 lua_pushvalue(l, -2);
525 lua_remove(l, -3);
526 pi_lua_multiple_push(l, args...);
527 pi_lua_protected_call(l, sizeof...(args) + 1, 2 + sizeof...(Ret));
528 auto ret_values = pi_lua_multiple_pull<Ret1, Ret2, Ret...>(l, -2 - static_cast<int>(sizeof...(Ret)));
529 lua_pop(l, 2 + static_cast<int>(sizeof...(Ret)));
530 LUA_DEBUG_END(l, 0);
531 return ret_values;
532}
533
534// specialise for SystemPath, which needs custom machinery to deduplicate system paths
535class SystemPath;
536template <>
538
539inline void pi_lua_generic_pull(lua_State *l, int index, SystemPath &out)
540{
541 assert(l == Lua::manager->GetLuaState());
543}
544
545inline void pi_lua_generic_push(lua_State *l, const SystemPath &value)
546{
547 assert(l == Lua::manager->GetLuaState());
549}
550
551// LuaPushPull stuff.
552template <class T>
553void pi_lua_generic_pull(lua_State *l, int index, T *&out)
554{
555 assert(l == Lua::manager->GetLuaState());
556 out = LuaObject<typename std::remove_cv<T>::type>::CheckFromLua(index);
557}
558
559template <class T>
560bool pi_lua_strict_pull(lua_State *l, int index, T *&out)
561{
562 assert(l == Lua::manager->GetLuaState());
563 out = LuaObject<typename std::remove_cv<T>::type>::GetFromLua(index);
564 return out != 0;
565}
566
567template <class T>
568void pi_lua_generic_push(lua_State *l, T *value)
569{
570 assert(l == Lua::manager->GetLuaState());
571 if (value)
573 else
574 lua_pushnil(l);
575}
576
577// LuaPushPull stuff.
578template <class T>
579void pi_lua_generic_pull(lua_State *l, int index, RefCountedPtr<T> &out)
580{
581 assert(l == Lua::manager->GetLuaState());
582 out = LuaObject<typename std::remove_cv<T>::type>::CheckFromLua(index);
583}
584
585template <class T>
586bool pi_lua_strict_pull(lua_State *l, int index, RefCountedPtr<T> &out)
587{
588 assert(l == Lua::manager->GetLuaState());
589 out = LuaObject<typename std::remove_cv<T>::type>::GetFromLua(index);
590 return out != 0;
591}
592
593template <class T>
594void pi_lua_generic_push(lua_State *l, RefCountedPtr<T> value)
595{
596 assert(l == Lua::manager->GetLuaState());
597 if (value)
599 else
600 lua_pushnil(l);
601}
602
603#endif
nlohmann::json Json
Definition Json.h:8
void pi_lua_generic_pull(lua_State *l, int index, SystemPath &out)
Definition LuaObject.h:539
bool(* PromotionTest)(LuaWrappable *o)
Definition LuaObject.h:74
void pi_lua_generic_push(lua_State *l, const SystemPath &value)
Definition LuaObject.h:545
bool pi_lua_strict_pull(lua_State *l, int index, T *&out)
Definition LuaObject.h:560
std::tuple< Types... > pi_lua_multiple_pull(lua_State *l, int beg)
Definition LuaPushPull.h:237
void pi_lua_multiple_push(lua_State *l, Types... args)
#define LUA_DEBUG_START(luaptr)
Definition LuaUtils.h:103
#define LUA_DEBUG_END(luaptr, expectedStackDiff)
Definition LuaUtils.h:104
void pi_lua_protected_call(lua_State *L, int nargs, int nresults)
Definition Sandbox.cpp:248
Definition DeleteEmitter.h:16
Definition LuaObject.h:360
LuaWrappable * GetObject() const override
Definition LuaObject.h:367
void ClearObject() override
Definition LuaObject.h:372
LuaComponentObject(T *o)
Definition LuaObject.h:362
Definition LuaObject.h:404
LuaWrappable * GetObject() const override
Definition LuaObject.h:420
LuaCopyObject(const T &o)
Definition LuaObject.h:406
~LuaCopyObject()
Definition LuaObject.h:414
Definition LuaObject.h:317
void ClearObject() override
Definition LuaObject.h:336
LuaCoreObject(T *o)
Definition LuaObject.h:319
~LuaCoreObject()
Definition LuaObject.h:325
LuaWrappable * GetObject() const override
Definition LuaObject.h:331
lua_State * GetLuaState()
Definition LuaManager.h:14
Definition LuaMetaType.h:44
Definition LuaObject.h:107
static void CreateObject(const luaL_Reg *methods, const luaL_Reg *attrs, const luaL_Reg *meta, bool protect=false)
Definition LuaObject.cpp:282
virtual void ClearObject()
Definition LuaObject.h:215
static void RegisterPersistent(LuaObjectBase *lo)
Definition LuaObject.cpp:563
static bool DeserializeComponents(LuaWrappable *object, const Json &obj)
Definition LuaObject.cpp:786
const char * GetType() const
Definition LuaObject.h:217
static LuaWrappable * CheckFromLua(int index, const char *type)
Definition LuaObject.cpp:633
static T * AllocateNew(Args &&...args)
Definition LuaObject.h:209
LuaObjectBase(const char *type)
Definition LuaObject.h:145
static PropertyMap * GetPropertiesFromObject(lua_State *l, int object)
Definition LuaObject.cpp:228
static LuaWrappable * GetFromLua(int index, const char *type)
Definition LuaObject.cpp:653
static T * Allocate()
Definition LuaObject.h:206
static void RegisterPromotion(const char *base_type, const char *target_type, PromotionTest test_fn)
Definition LuaObject.cpp:709
static bool SerializeToJson(lua_State *l, Json &out)
Definition LuaObject.cpp:826
static void CreateClass(const char *type, const char *parent, const luaL_Reg *methods, const luaL_Reg *attrs, const luaL_Reg *meta)
Definition LuaObject.cpp:339
virtual ~LuaObjectBase()
Definition LuaObject.h:147
static bool PushRegistered(LuaWrappable *o)
Definition LuaObject.cpp:446
static void Register(LuaObjectBase *lo)
Definition LuaObject.cpp:480
static bool SerializeComponents(LuaWrappable *object, Json &out)
Definition LuaObject.cpp:735
static void RegisterSerializer(const char *type, SerializerPair pair)
Definition LuaObject.cpp:714
static void DeregisterObject(LuaWrappable *object)
Definition LuaObject.cpp:581
virtual LuaWrappable * GetObject() const =0
static bool DeserializeFromJson(lua_State *l, const Json &obj)
Definition LuaObject.cpp:857
Definition LuaObject.cpp:98
Definition LuaObject.h:235
static T * CheckFromLua(int idx)
Definition LuaObject.h:262
static void PushComponentToLua(LuaWrappable *o)
Definition LuaObject.h:464
static void PushToLua(DeleteEmitter *o)
Definition LuaObject.h:457
static Ret CallMethod(T *o, const Key &key, const Args &...args)
Definition LuaObject.h:493
static void CallMethod(T *o, const Key &key, const Args &...args)
Definition LuaObject.h:252
LuaObject()
Definition LuaObject.h:298
static bool DynamicCastPromotionTest(LuaWrappable *o)
Definition LuaObject.h:288
static void CreateInLua(Args &&...args)
Definition LuaObject.h:485
static T * GetFromLua(int idx)
Definition LuaObject.h:275
static void RegisterClass()
Definition LuaObject.h:433
~LuaOwnObject()
Definition LuaObject.h:440
LuaWrappable * GetObject() const override
Definition LuaObject.h:445
LuaOwnObject(T *o)
Definition LuaObject.h:435
Definition LuaRef.h:12
Definition LuaSerializer.h:14
Definition LuaObject.h:386
LuaSharedObject(T *o)
Definition LuaObject.h:388
LuaWrappable * GetObject() const override
Definition LuaObject.h:391
Definition LuaWrappable.h:13
Definition Property.h:171
Definition RefCounted.h:36
Definition RefCounted.h:11
T * Get() const
Definition SmartPtr.h:37
Definition SystemPath.h:13
LuaManager * manager
Definition Lua.cpp:43
Definition GeomTree.h:9
Definition LuaObject.h:82
SerializerPair(Serializer serialize_, Deserializer deserialize_)
Definition LuaObject.h:93
bool(*)(lua_State *l, const Json &obj) Deserializer
Definition LuaObject.h:86
SerializerPair()
Definition LuaObject.h:88
Serializer serialize
Definition LuaObject.h:98
Deserializer deserialize
Definition LuaObject.h:99