aboutsummaryrefslogtreecommitdiff
path: root/src/lindafactory.hpp
blob: 814f21c970905c6bfdbd36039ee2c2eb5afaaf8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include "deep.hpp"

// #################################################################################################

class LindaFactory final
: public DeepFactory
{
    public:
    // TODO: I'm not totally happy with having a 'global' variable. Maybe it should be dynamically created and stored somewhere in the universe?
    static LindaFactory Instance;

    ~LindaFactory() override = default;
    LindaFactory(luaL_Reg const lindaMT_[])
    : mLindaMT{ lindaMT_ }
    {
    }

    private:
    luaL_Reg const* const mLindaMT{ nullptr };

    void createMetatable(lua_State* L_) const override;
    void deleteDeepObjectInternal(lua_State* L_, DeepPrelude* o_) const override;
    [[nodiscard]]
    std::string_view moduleName() const override;
    [[nodiscard]]
    DeepPrelude* newDeepObjectInternal(lua_State* L_) const override;
};