diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-11 01:15:09 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-11 01:15:09 +0500 |
| commit | 22f27c37844eeb814f304dc18597f3308ef7a441 (patch) | |
| tree | 2add298f33928dba68dabfef2c20f142c3f3cbac /bot | |
| parent | 87889f2efcdce62f680a5286ae0ecf86a9e09ca9 (diff) | |
feat: str_split lua function
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/src/commands/lua.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bot/src/commands/lua.cpp b/bot/src/commands/lua.cpp index 2910fdf..75261ec 100644 --- a/bot/src/commands/lua.cpp +++ b/bot/src/commands/lua.cpp @@ -337,11 +337,19 @@ namespace bot::command::lua { }); } + void add_string_library(std::shared_ptr<sol::state> state) { + state->set_function("str_split", + [](const std::string &text, const char &delimiter) { + return utils::string::split_text(text, delimiter); + }); + } + void add_base_libraries(std::shared_ptr<sol::state> state) { add_bot_library(state); add_time_library(state); add_json_library(state); add_net_library(state); + add_string_library(state); add_l10n_library(state); } |
