Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Normalize ascii_world demo require paths to relative style

Đang mở
#754 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
76/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
lua
Lĩnh vực
game-dev

Hướng nghiên cứu

Start by inspecting the six Lua files under lua-learning-website/public/demos/ascii_world/ and compare their require style with the other demos. Run /demos/ascii_world/main.lua in the editor, then run the existing demos-related e2e tests. Done means the game still supports movement, combat, and NPCs, with no remaining require("demos/...") matches under public/demos/ascii_world/.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

tech-debt

Background

In PR #751, `ascii_world` was migrated from `/examples` to `/demos`. Its internal requires used mount-absolute paths (`require("examples/ascii_world/config")`) which were mechanically rewritten to `require("demos/ascii_world/config")`. The reviewer flagged the inconsistency:

`flaming-goat/main.lua` uses relative `require("state")` and `require("rooms.subway")` while ascii_world uses absolute mount-path requires (`require("demos/ascii_world/config")`). [...] verify this is stable if the demo is ever moved, or normalize to absolute requires for consistency.

All other demos (`minesweeper`, `space_shooter`, `flaming-goat`) use the project's prevailing relative require style and have been validated to work via e2e. `ascii_world` is the outlier.

Proposal

Normalize `ascii_world` to relative requires to match the other three demos. This also makes the workspace mount-agnostic — if `/demos` is ever re-mounted or renamed, nothing breaks.

Example:

```lua
-- Before (ascii_world/game.lua)
local config = require("demos/ascii_world/config")
local ui = require("demos/ascii_world/ui")

-- After
local config = require("config")
local ui = require("ui")
```

Files

Six `.lua` files under `lua-learning-website/public/demos/ascii_world/` currently hold mount-absolute requires:

  • `main.lua` — `require("demos/ascii_world/game")`
  • `game.lua` — 7 internal requires
  • `ui.lua` — 1 require
  • `combat.lua` — 4 requires
  • `maps.lua` — 1 require
  • `player.lua` — 2 requires

(`config.lua`, `items.lua`, `monsters.lua` don't need changes.)

Verification

  • Manually run `/demos/ascii_world/main.lua` in the editor — game starts, movement/combat/NPCs work
  • Existing demos-related e2e tests still pass
  • No remaining `require("demos/...")` matches under `public/demos/ascii_world/`

Risk

Low. Lua's require resolver already supports this style — minesweeper, space_shooter, and flaming-goat all rely on it. This is a consistency normalization, not a behavior change.

Deferred from #751 per reviewer feedback.

Ngôn ngữ chính
TypeScript
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của jcollard/LuaInTheWeb

Tất cả issue của jcollard/LuaInTheWeb

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.