forward declare context and remove getter error handling

This commit is contained in:
Cody Glassman 2025-08-01 17:26:38 -07:00
parent 624df21a9c
commit 9fd0a66787
2 changed files with 7 additions and 12 deletions

View File

@ -1,7 +1,7 @@
#include "clipboardbindings.hpp" #include "clipboardbindings.hpp"
#include <SDL.h>
#include <SDL_clipboard.h> #include <SDL_clipboard.h>
#include <SDL_error.h>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
@ -17,15 +17,10 @@ namespace MWLua
api["get"] = []() { api["get"] = []() {
std::string text; std::string text;
if (char* raw = SDL_GetClipboardText()) char* raw = SDL_GetClipboardText();
{ text = raw;
text = raw;
SDL_free(raw); SDL_free(raw);
}
else
{
Log(Debug::Error) << "Failed to get clipboard content: " << SDL_GetError();
}
return text; return text;
}; };

View File

@ -3,10 +3,10 @@
#include <sol/forward.hpp> #include <sol/forward.hpp>
#include "context.hpp"
namespace MWLua namespace MWLua
{ {
struct Context;
sol::table initClipboardPackage(const Context&); sol::table initClipboardPackage(const Context&);
} }