Skip to content

Commit 888453a

Browse files
committed
fix(gamestore): preload taskboard integration
Register gamestore.taskboard in the Game Store bootstrap so purchases and player offer checks can require the adapter without relying on data/libs being present in package.path. Add a standalone regression test that loads gamestore/init.lua with the server-style restricted Lua search path and verifies the dependent modules initialize successfully. Validation: all Lua contract scripts passed, including test_gamestore_bootstrap.lua (1 passed, 0 failed); StyLua check passed.
1 parent a43f6f3 commit 888453a

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

data/modules/scripts/gamestore/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ local modulesToPreload = {
1717
["gamestore.senders"] = function()
1818
return moduleLoader("senders")
1919
end,
20+
["gamestore.taskboard"] = function()
21+
return moduleLoader("taskboard")
22+
end,
2023
["gamestore.purchases"] = function()
2124
return moduleLoader("purchases")
2225
end,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-- Standalone bootstrap contract for the Game Store module loader.
2+
-- Run from the repository root with: lua tests/lua/test_gamestore_bootstrap.lua
3+
4+
CORE_DIRECTORY = "data"
5+
Player = {}
6+
7+
for name in pairs(package.loaded) do
8+
if name:match("^gamestore%.") then
9+
package.loaded[name] = nil
10+
end
11+
end
12+
for name in pairs(package.preload) do
13+
if name:match("^gamestore%.") then
14+
package.preload[name] = nil
15+
end
16+
end
17+
18+
local originalPath = package.path
19+
package.path = ".\\?.lua;.\\?\\init.lua"
20+
local loaded, reason = pcall(dofile, "data/modules/scripts/gamestore/init.lua")
21+
package.path = originalPath
22+
23+
assert(loaded, reason)
24+
assert(type(package.preload["gamestore.taskboard"]) == "function")
25+
assert(type(package.loaded["gamestore.purchases"]) == "table")
26+
assert(type(package.loaded["gamestore.player"]) == "table")
27+
28+
print("\n1 passed, 0 failed")

0 commit comments

Comments
 (0)