This commit is contained in:
MihailRis
2025-11-16 18:35:04 +03:00
parent 2a8fa4f2fa
commit 536035441a
5 changed files with 26 additions and 3 deletions
+6 -2
View File
@@ -4,12 +4,16 @@
#include "io/devices/MemoryDevice.hpp"
static int l_create_memory_device(lua::State* L) {
auto name = lua::require_string(L, 1);
std::string name = lua::require_string(L, 1);
if (io::get_device(name)) {
throw std::runtime_error(
"entry-point '" + std::string(name) + "' is already used"
"entry-point '" + name + "' is already used"
);
}
if (name.find(':') != std::string::npos) {
throw std::runtime_error("invalid entry point name");
}
io::set_device(name, std::make_unique<io::MemoryDevice>());
return 0;
}