galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
LuaPlatform.cpp
Go to the documentation of this file.
1
7
8#include <entt/locator/locator.hpp>
9#include <sol/sol.hpp>
10
13
14namespace galaxy
15{
16 namespace lua
17 {
19 {
20 auto& lua = entt::locator<sol::state>::value();
21
22#ifdef GALAXY_WIN_PLATFORM
23 lua.set("galaxy_win_platform", true);
24 lua.set("galaxy_unix_platform", false);
25#elif GALAXY_UNIX_PLATFORM
26 lua.set("galaxy_win_platform", false);
27 lua.set("galaxy_unix_platform", true);
28#endif
29
30 auto sub_type = lua.new_usertype<platform::Subprocess>("Subprocess", sol::constructors<platform::Subprocess(), platform::Subprocess(std::string_view)>());
31 sub_type["create"] = &platform::Subprocess::create;
32 sub_type["join"] = &platform::Subprocess::join;
33 sub_type["terminate"] = &platform::Subprocess::terminate;
34 sub_type["destroy"] = &platform::Subprocess::destroy;
35 sub_type["alive"] = &platform::Subprocess::alive;
36 }
37 } // namespace lua
38} // namespace galaxy
Manages a subprocess launched by galaxy.
void destroy() noexcept
Destroy process, preserving if alive.
void create(std::string_view process, std::span< std::string > args={})
Launch a subprocess.
int join() noexcept
Wait for a process to finish execution.
bool alive() noexcept
Check if subprocess is still alive and executing.
void terminate() noexcept
Terminate process, killing if alive.
void inject_platform()
Inject platform stuff into Lua.
Timer.hpp galaxy.
Definition Async.hpp:17