$darkmode
lua_api.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  */
26 #pragma once
27 
28 #include <filesystem> // for std::filesystem::path
29 
30 #include <sol/protected_function_result.hpp> // for protected_function_result
31 #include <sol/state_view.hpp> // for state_view
32 
33 namespace cloe {
34 
38 [[nodiscard]] sol::protected_function_result lua_safe_script_file(
39  sol::state_view& lua, const std::filesystem::path& filepath);
40 
49 [[nodiscard]] inline auto luat_cloe_engine(sol::state_view& lua) {
50  return lua["package"]["loaded"]["cloe-engine"];
51 }
52 
53 [[nodiscard]] inline auto luat_cloe_engine_fs(sol::state_view& lua) {
54  return lua["package"]["loaded"]["cloe-engine.fs"];
55 }
56 
57 [[nodiscard]] inline auto luat_cloe_engine_types(sol::state_view& lua) {
58  return lua["package"]["loaded"]["cloe-engine.types"];
59 }
60 
61 [[nodiscard]] inline auto luat_cloe_engine_initial_input(sol::state_view& lua) {
62  return lua["package"]["loaded"]["cloe-engine"]["initial_input"];
63 }
64 
65 [[nodiscard]] inline auto luat_cloe_engine_state(sol::state_view& lua) {
66  return lua["package"]["loaded"]["cloe-engine"]["state"];
67 }
68 
69 [[nodiscard]] inline auto luat_cloe_engine_plugins(sol::state_view& lua) {
70  return lua["package"]["loaded"]["cloe-engine"]["plugins"];
71 }
72 
73 } // namespace cloe
auto luat_cloe_engine(sol::state_view &lua)
Definition: lua_api.hpp:49