v0.13.8
errors and warnings / bundling

errors and warnings / bundling / W6001

W6001 warning

Code reads a Lua file name from debugstack or debuglocals, which shows the bundle's when bundled

area
bundling (x6xxx)
fails the build
with --deny-warnings

A bundled file calls debugstack or debuglocals and has a string holding .lua, so it most likely reads its own Lua file name from the stack. Bundling (on in release builds) puts the files into one file, so the stack shows the bundle's name and line instead, and code that matches on its own file name stops finding it. Reading the addon's folder (AddOns/<name>/) is fine: the bundle keeps it. Keeping or showing a stack is fine too, because wowlua trace maps it back.

Match on the addon's folder instead of the file name, or turn bundling off for the profile with "bundle": false. Libraries that call either function are never bundled, so this warning is only about your own files. The examples turn bundling on for the dev profile, so that wowlua check sees it.

Example

× failswowlua.jsonjson
{    "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" },    "flavors": { "camelot": {} },    "profiles": { "dev": { "bundle": true } }}
src/main.lualua
local file = debugstack(1, 1, 0):match("([^/\\]+)%.lua")print(file)
✓ compileswowlua.jsonjson
{    "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" },    "flavors": { "camelot": {} },    "profiles": { "dev": { "bundle": true } }}
src/main.lualua
local folder = debugstack(1, 1, 0):match("AddOns[/\\]([^/\\]+)")print(folder)

The compiler reports it like this:

warning[W6001]: this file reads a Lua file name from `debugstack` or `debuglocals`, which see the bundle's file name, not this file's
 = in src/main.lua
 = help: `wowlua trace` maps bundle locations back; or turn bundling off with `bundle: false`

Offline

terminal
$ wowlua explain W6001
W6001 (warning): Code reads a Lua file name from debugstack or debuglocals, which shows the bundle's when bundled

source on GitHub ↗