Example #1
0
 /// <summary>
 /// Creates a new LUA state from the given state. The class will not try load the
 /// default libraries for this instance.
 /// </summary>
 /// <param name="state">An existing LUA state.</param>
 public LuaState(IntPtr state)
 {
     if (state == IntPtr.Zero)
     { // Invalid parameter
         throw new ArgumentException("State must not be zero.", "state");
     }
     lua = state;
     stack = new LuaStack(this);
     tables = new LuaTables(this);
     gc = new LuaGC(this);
 }
Example #2
0
 /// <summary>
 /// Creates a new empty LUA state object.
 /// </summary>
 public LuaState()
 {
     lua = NativeLua.lua_open();
     if (lua == IntPtr.Zero)
     { // Error initializing subsystem
         throw new LuaException("Error initializing LUA subsystem");
     }
     stack = new LuaStack(this);
     tables = new LuaTables(this);
     gc = new LuaGC(this);
 }