Package com.prineside.luaj
Class LuaError
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.prineside.luaj.LuaError
- All Implemented Interfaces:
Serializable
RuntimeException that is thrown and caught in response to a lua error.
LuaError
is used wherever a lua call to error()
would be used within a script.
Since it is an unchecked exception inheriting from RuntimeException
,
Java method signatures do notdeclare this exception, althoug it can
be thrown on almost any luaj Java operation.
This is analagous to the fact that any lua script can throw a lua error at any time.
The LuaError may be constructed with a message object, in which case the message is the string representation of that object. getMessageObject will get the object supplied at construct time, or a LuaString containing the message of an object was not supplied.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a LuaError with a LuaValue as the message object, and level to draw line number information from.Construct a LuaError with a specific message.Construct a LuaError with a message, and level to draw line number information from.Construct LuaError when a program exception occurs. -
Method Summary
Modifier and TypeMethodDescriptiongetCause()
Get the cause, if any.Get the string message if it was supplied, or a string representation of the message object if that was supplied.Get the LuaValue that was provided in the constructor, or a LuaString containing the message if it was a string error argument.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
LuaError
Construct LuaError when a program exception occurs.All errors generated from lua code should throw LuaError(String) instead.
- Parameters:
cause
- the Throwable that caused the error, if known.
-
LuaError
Construct a LuaError with a specific message.- Parameters:
message
- message to supply
-
LuaError
Construct a LuaError with a message, and level to draw line number information from.- Parameters:
message
- message to supplylevel
- where to supply line info from in call stack
-
LuaError
-
LuaError
Construct a LuaError with a LuaValue as the message object, and level to draw line number information from.- Parameters:
message_object
- message string or object to supply
-
-
Method Details
-
getMessage
Get the string message if it was supplied, or a string representation of the message object if that was supplied.- Overrides:
getMessage
in classThrowable
-
getMessageObject
Get the LuaValue that was provided in the constructor, or a LuaString containing the message if it was a string error argument.- Returns:
- LuaValue which was used in the constructor, or a LuaString containing the message.
-
getCause
Get the cause, if any.
-