summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index 4a9a6ef..a06f768 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -43,6 +43,11 @@ pub enum Error {
/// This error can only happen when Lua state was not created by us and does not have the
/// custom allocator attached.
MemoryLimitNotAvailable,
+ /// Main thread is not available.
+ ///
+ /// This error can only happen in Lua5.1/LuaJIT module mode, when module loaded within a coroutine.
+ /// These Lua versions does not have `LUA_RIDX_MAINTHREAD` registry key.
+ MainThreadNotAvailable,
/// A mutable callback has triggered Lua code that has called the same mutable callback again.
///
/// This is an error because a mutable callback can only be borrowed mutably once.
@@ -161,6 +166,9 @@ impl fmt::Display for Error {
Error::MemoryLimitNotAvailable => {
write!(fmt, "setting memory limit is not available")
}
+ Error::MainThreadNotAvailable => {
+ write!(fmt, "main thread is not available in Lua 5.1")
+ }
Error::RecursiveMutCallback => write!(fmt, "mutable callback called recursively"),
Error::CallbackDestructed => write!(
fmt,