aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lanes.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp
index d58f113..0b29a8f 100644
--- a/src/lanes.cpp
+++ b/src/lanes.cpp
@@ -215,12 +215,15 @@ LUAG_FUNC(require)
215// lanes.register( "modname", module) 215// lanes.register( "modname", module)
216int lanes_register(lua_State* const L_) 216int lanes_register(lua_State* const L_)
217{ 217{
218 Universe* const _U{ Universe::Get(L_) };
219 if (!_U) {
220 raise_luaL_error(L_, "Lanes is not ready");
221 }
218 std::string_view const _name{ luaG_checkstring(L_, StackIndex{ 1 }) }; 222 std::string_view const _name{ luaG_checkstring(L_, StackIndex{ 1 }) };
219 LuaType const _mod_type{ luaG_type(L_, StackIndex{ 2 }) }; 223 LuaType const _mod_type{ luaG_type(L_, StackIndex{ 2 }) };
220 // ignore extra arguments, just in case 224 // ignore extra arguments, just in case
221 lua_settop(L_, 2); 225 lua_settop(L_, 2);
222 luaL_argcheck(L_, (_mod_type == LuaType::TABLE) || (_mod_type == LuaType::FUNCTION), 2, "unexpected module type"); 226 luaL_argcheck(L_, (_mod_type == LuaType::TABLE) || (_mod_type == LuaType::FUNCTION), 2, "unexpected module type");
223 DEBUGSPEW_CODE(Universe* _U = Universe::Get(L_));
224 STACK_CHECK_START_REL(L_, 0); // "name" mod_table 227 STACK_CHECK_START_REL(L_, 0); // "name" mod_table
225 DEBUGSPEW_CODE(DebugSpew(_U) << "lanes.register '" << _name << "' BEGIN" << std::endl); 228 DEBUGSPEW_CODE(DebugSpew(_U) << "lanes.register '" << _name << "' BEGIN" << std::endl);
226 DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U }); 229 DEBUGSPEW_CODE(DebugSpewIndentScope _scope{ _U });