Add check for validity with object in require_file

Closes #193
This commit is contained in:
Kevin Brightwell 2016-08-22 17:13:25 -04:00
parent 683943dd02
commit a6c95dbb74

View File

@ -94,7 +94,7 @@ namespace sol {
template <typename Fx>
object require_core(const std::string& key, Fx&& action, bool create_global = true) {
optional<object> loaded = is_loaded_package(key);
if (loaded)
if (loaded && loaded->valid())
return std::move(*loaded);
action();
auto sr = stack::get<stack_reference>(L);