Chi-Tech
chi_console_constrdestr.cc
Go to the documentation of this file.
2
3#include "lua/chi_modules_lua.h"
4
5#include "chi_configuration.h"
6
7#include "ChiObjectFactory.h"
8
9//###################################################################
10/**Access to the singleton*/
12{
13 static Console singleton;
14 return singleton;
15}
16
17//###################################################################
18/** Default constructor for the console*/
20 console_state_(luaL_newstate())
21{
22
23}
24
25//###################################################################
26/**Registers all lua items so that they are available in the console.*/
28{
29 //=================================== Initializing console
30 auto& L = GetConsoleState();
31
32 luaL_openlibs(L);
33
34 //=================================== Register version
35 lua_pushstring(L, PROJECT_VERSION); lua_setglobal(L,"chi_version");
36 lua_pushinteger(L,PROJECT_MAJOR_VERSION);lua_setglobal(L,"chi_major_version");
37 lua_pushinteger(L,PROJECT_MINOR_VERSION);lua_setglobal(L,"chi_minor_version");
38 lua_pushinteger(L,PROJECT_PATCH_VERSION);lua_setglobal(L,"chi_patch_version");
39
40 //=================================== Registering functions
41 chi_modules::lua_utils::RegisterLuaEntities(L);
42
43 //=================================== Registering static-registration
44 // lua functions
45 for (const auto& [key, entry] : lua_function_registry_)
46 SetLuaFuncNamespaceTableStructure(key, entry.function_ptr);
47
48 //=================================== Registering LuaFunctionWrappers
49 for (const auto& [key, entry] : function_wrapper_registry_)
50 if (entry.call_func)
51 SetLuaFuncWrapperNamespaceTableStructure(key);
52
53 for (const auto& [key, value] : lua_constants_registry_)
54 SetLuaConstant(key, value);
55
56 //=================================== Registering solver-function
57 // scope resolution tables
58 const auto& object_maker = ChiObjectFactory::GetInstance();
59 for (const auto& entry : object_maker.Registry())
60 SetObjectNamespaceTableStructure(entry.first);
61
62}
63
64
#define PROJECT_MAJOR_VERSION
#define PROJECT_MINOR_VERSION
#define PROJECT_VERSION
#define PROJECT_PATCH_VERSION
static ChiObjectFactory & GetInstance() noexcept
static Console & GetInstance() noexcept