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
LuaUtils.cpp
Go to the documentation of this file.
1
7
8#include <entt/locator/locator.hpp>
9#include <sol/sol.hpp>
10
11#include "galaxy/utils/Guid.hpp"
13
14namespace galaxy
15{
16 namespace lua
17 {
19 {
20 auto& lua = entt::locator<sol::state>::value();
21
22 auto guid_type = lua.new_usertype<utils::Guid>("Guid", sol::constructors<utils::Guid()>());
23 guid_type["as_string"] = &utils::Guid::to_string;
24
25 lua.set_function("str_split", &strutils::split);
26 // lua.set_function("str_replace_first", &strutils::replace_first);
27 // lua.set_function("str_replace_all", &strutils::replace_all);
28 lua.set_function("str_begins_with", &strutils::begins_with);
29 // lua.set_function("str_rtrim", &strutils::rtrim);
30 // lua.set_function("str_ltrim", &strutils::ltrim);
31 // lua.set_function("str_trim", &strutils::trim);
32 // lua.set_function("str_make_single_spaced", &strutils::make_single_spaced);
33 }
34 } // namespace lua
35} // namespace galaxy
Contains a 128bit randomly generated GUID, along with helper functions.
Definition Guid.hpp:22
const std::string & to_string() const noexcept
Get the GUID as a string.
Definition Guid.cpp:77
void inject_utils()
Injects misc galaxy utils into lua.
Definition LuaUtils.cpp:18
bool begins_with(const std::string &input, const std::string &find) noexcept
Check if string begins with another string.
std::vector< std::string > split(std::string_view input, std::string_view delim) noexcept
Split a string based on a delimiter.
Timer.hpp galaxy.
Definition Async.hpp:17