diff --git a/src/logic/scripting/lua/libs/libentity.cpp b/src/logic/scripting/lua/libs/libentity.cpp index af7a938ad..a4131c234 100644 --- a/src/logic/scripting/lua/libs/libentity.cpp +++ b/src/logic/scripting/lua/libs/libentity.cpp @@ -70,10 +70,7 @@ static int l_get_def(lua::State* L) { static int l_spawn(lua::State* L) { auto level = controller->getLevel(); - auto defname = lua::tostring(L, 1); - if (defname == nullptr) { - throw std::runtime_error("string expected, got nil"); - } + auto defname = lua::require_string(L, 1); auto& def = content->entities.require(defname); auto pos = lua::tovec3(L, 2); dv::value args = nullptr;