public static LuaBoard Create(BasicBoard board) { int size = board.size; LuaBoard b = new LuaBoard(size); b.ResetWithSize(size); for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { b.tiles[x + y * size].SetState(board.GetTileState(x, y)); } } //MoonSharp.Interpreter. return b; }
private void SetBoardState(BasicBoard board) { currentState = LuaBoard.Create(board); UserData.RegisterType<LuaBoard>(); UserData.RegisterType<BasicBoard.Score>(); script.Globals["ai", "currentBoard"] = UserData.Create(currentState); }