Class DebugLib

All Implemented Interfaces:
KryoSerializable

public class DebugLib extends TwoArgFunction implements KryoSerializable
Subclass of LibFunction which implements the lua standard debug library.

The debug library in luaj tries to emulate the behavior of the corresponding C-based lua library. To do this, it must maintain a separate stack of calls to LuaClosure and LibFunction instances. Especially when lua-to-java bytecode compiling is being used this cannot be done in all cases.

Typically, this library is included as part of a call to either

 
 Globals globals = JsePlatform.debugGlobals();
 System.out.println( globals.get("debug").get("traceback").call() );
  

To instantiate and use it directly, link it into your globals table via LuaValue.load(LuaValue) using code such as:

 
 Globals globals = new Globals();
 globals.load(new JseBaseLib());
 globals.load(new PackageLib());
 globals.load(new DebugLib());
 System.out.println( globals.get("debug").get("traceback").call() );
  

This library exposes the entire state of lua code, and provides method to see and modify all underlying lua values within a Java VM so should not be exposed to client code in a shared server environment.

See Also: