mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Merge pull request #194 from Nava2/require-file-fix
Add check for validity with object in `require_file`
This commit is contained in:
commit
a7423a5005
|
@ -94,7 +94,7 @@ namespace sol {
|
||||||
template <typename Fx>
|
template <typename Fx>
|
||||||
object require_core(const std::string& key, Fx&& action, bool create_global = true) {
|
object require_core(const std::string& key, Fx&& action, bool create_global = true) {
|
||||||
optional<object> loaded = is_loaded_package(key);
|
optional<object> loaded = is_loaded_package(key);
|
||||||
if (loaded)
|
if (loaded && loaded->valid())
|
||||||
return std::move(*loaded);
|
return std::move(*loaded);
|
||||||
action();
|
action();
|
||||||
auto sr = stack::get<stack_reference>(L);
|
auto sr = stack::get<stack_reference>(L);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user