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
12
13namespace galaxy
14{
15 namespace lua
16 {
18 {
19 auto& lua = entt::locator<sol::state>::value();
20
21 lua.set_function("str_split", &str::split);
22 lua.set_function("str_replace_first", &str::replace_first);
23 lua.set_function("str_replace_all", &str::replace_all);
24 lua.set_function("str_begins_with", &str::begins_with);
25 lua.set_function("str_rtrim", &str::rtrim);
26 lua.set_function("str_ltrim", &str::ltrim);
27 lua.set_function("str_trim", &str::trim);
28 lua.set_function("str_make_single_spaced", &str::make_single_spaced);
29 }
30 } // namespace lua
31} // namespace galaxy
void inject_utils()
Injects misc galaxy utils into lua.
Definition LuaUtils.cpp:17
std::string rtrim(std::string input) noexcept
Trim string from start.
std::string replace_all(std::string input, std::string_view to_replace, std::string_view replace_with) noexcept
Replaces all occurrences of a string.
std::vector< std::string > split(std::string_view input, std::string_view delim) noexcept
Split a string based on a delimiter.
std::string ltrim(std::string input) noexcept
Trim string from end.
bool begins_with(const std::string &input, const std::string &find) noexcept
Check if string begins with another string.
std::string trim(std::string input) noexcept
Trim both ends of string.
std::string make_single_spaced(std::string input) noexcept
Make a string single spaced.
std::string replace_first(std::string input, std::string_view to_replace, std::string_view replace_with) noexcept
Replace first occurrence of a string.
Timer.hpp galaxy.
Definition Timer.cpp:18