$darkmode
lua_setup.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Robert Bosch GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
24 #pragma once
25 
26 #include <iostream> // for ostream, cerr
27 #include <memory> // for shared_ptr<>
28 #include <optional> // for optional<>
29 #include <string> // for string
30 #include <vector> // for vector<>
31 
32 #include <sol/state.hpp>
33 #include <sol/state_view.hpp>
34 #include <sol/table.hpp>
35 
36 #include <fable/environment.hpp> // for Environment
37 
38 namespace cloe {
39 
40 class Stack;
41 
42 struct LuaOptions {
43  std::shared_ptr<fable::Environment> environment;
44 
45  std::vector<std::string> lua_paths;
46  bool no_system_lua = false;
47  bool auto_require_cloe = false;
48 };
49 
59 void setup_lua(sol::state_view lua, const LuaOptions& opt, Stack& s);
60 
61 #if CLOE_ENGINE_WITH_LRDB
68 void start_lua_debugger(sol::state_view lua, int listen_port);
69 #endif
70 
76 void merge_lua(sol::state_view lua, const std::string& filepath);
77 
97 void register_lib_fs(sol::table& lua);
98 
105 void register_usertype_duration(sol::table& lua);
106 
113 void register_usertype_sync(sol::table& lua);
114 
120 void register_usertype_stack(sol::table& lua);
121 
122 } // namespace cloe
void register_usertype_stack(sol::table &lua)
Definition: lua_setup_stack.cpp:27
void register_usertype_sync(sol::table &lua)
Definition: lua_setup_sync.cpp:25
void register_usertype_duration(sol::table &lua)
Definition: lua_setup_duration.cpp:26
void register_lib_fs(sol::table &lua)
Definition: lua_setup_fs.cpp:76
Definition: lua_setup.hpp:42