Comments (10)
I have tracked down the issue to comments with wrong tags (such as the @description
found on this lua implementation for a RNG):
---
-- @description creates an instance of the rng
-- @return table an instance of the rng
--
The following error can also happen:
template failed for lib.utils.random: ...pps/luarocks/current/rocks/share/lua/5.4/ldoc\markup.lua:302: attempt to call a nil value (method 'gsub')
stack traceback:
...pps/luarocks/current/rocks/share/lua/5.4/ldoc\markup.lua:302: in function 'ldoc.markup.processor'
(...tail calls...)
[string "TMP"]:153: in function <[string "TMP"]:1>
[C]: in function 'xpcall'
...pps/luarocks/current/rocks/share/lua/5.4/pl\template.lua:140: in function <...pps/luarocks/current/rocks/share/lua/5.4/pl\template.lua:133>
(...tail calls...)
.../apps/luarocks/current/rocks/share/lua/5.4/ldoc\html.lua:283: in local 'templatize'
.../apps/luarocks/current/rocks/share/lua/5.4/ldoc\html.lua:375: in function 'ldoc.html.generate_output'
...rrent\rocks\lib\luarocks\rocks-5.4\ldoc\1.4.6-2\bin\ldoc:830: in main chunk
[C]: in ?
After removing the wrong tag, the error is solved.
Should this have a better error message?
from ldoc.
Can you post an MWE and the error with error you get with v1.5.0? The example you show seems to work fine more me (in that it gives a sensible error about what is wrong with the input) not the stack trace you are showing.
from ldoc.
Apparently I'm running 1.4.6 (It's the latest one available on luarocks
).
I'll try it later on a manually installed copy of 1.5.0.
from ldoc.
Ldoc v1.5.0 has been on LuaRocks since a few seconds of the tag being pushed to GitHub. What makes you say 1.4.6 is the latest?
from ldoc.
I guess I just had an old version. Doesn't matter though, I'm still having the issue on 1.5.0.
I'll try to produce a MWE
from ldoc.
Yeah, I'm not sure why you're not getting the error. This is enough for me to reproduce it:
---
-- @description get a clone of the current state
-- @return a table representing the full state, containing mti (number) and mt (table of numbers)
function getState()
local r = {}
r.mti = mti
r.mt = {}
for i=0,N-1 do
r.mt[i] = mt[i]
end
return r
end
Which yields the error:
[REDACTED]\lib\utils\random.lua:1: contains no items
template failed for random: ...pps/luarocks/current/rocks/share/lua/5.4/ldoc\markup.lua:313: attempt to call a nil value (method 'gsub')
stack traceback:
...pps/luarocks/current/rocks/share/lua/5.4/ldoc\markup.lua:313: in function 'ldoc.markup.processor'
(...tail calls...)
[string "TMP"]:174: in function <[string "TMP"]:1>
[C]: in function 'xpcall'
...pps/luarocks/current/rocks/share/lua/5.4/pl\template.lua:140: in function <...pps/luarocks/current/rocks/share/lua/5.4/pl\template.lua:133>
(...tail calls...)
.../apps/luarocks/current/rocks/share/lua/5.4/ldoc\html.lua:283: in local 'templatize'
.../apps/luarocks/current/rocks/share/lua/5.4/ldoc\html.lua:320: in function 'ldoc.html.generate_output'
...rrent\rocks\lib\luarocks\rocks-5.4\ldoc\1.5.0-1\bin\ldoc:898: in main chunk
[C]: in ?
Specs:
- Ldoc 1.5.0
- Windows 10 Home 19044.2846
- Lua 5.4.2
(You can ask for more info if you wish. I'm just not sure what info would help)
from ldoc.
I am able to reproduce that error, but not with the original circumstances of "it throws an error when pointing to the directory but works if pointing directly to a single file". I get the error when calling just on the file too. Is that still the case for you?
from ldoc.
Also, this error appears to be caused because you are using an undefined tag. Change -- @description get a ...
to -- get a ...
and it seems to work fine. Where did you get @description
from?
from ldoc.
I am able to reproduce that error, but not with the original circumstances of "it throws an error when pointing to the directory but works if pointing directly to a single file". I get the error when calling just on the file too. Is that still the case for you?
Yep. I can't replicate that anymore. It also fails with just the file.
Also, this error appears to be caused because you are using an undefined tag. Change -- @description get a ... to -- get a ... and it seems to work fine. Where did you get @description from?
I already mentioned that it's caused by @description
, and which repo it comes from, an RNG implementation. See comment #389 (comment).
My contention is not really that an error happens, but that it is obtuse and it doesn't point to why. It simply fails catastrophically.
I think it should still fail, with with a clean message, such as "Error in path/to/file.lua, line 116: invalid tag '@description' used
", or something akin to that.
from ldoc.
I missed that detail on trying to catch up the issue. I think it's clear now with an MWE and what needs fixing. This should be a relatively easy one to add a test with explicit error rather than falling through to a Lua error indexing undefined keys if anybody wants to tackle this.
from ldoc.
Related Issues (20)
- luarocks install ldoc throw 404 HOT 1
- Representing module with constants HOT 2
- LDoc fails to reference to a table value HOT 1
- Using custom CSS (-s option) fails with error: ldoc/tools.lua:233: attempt to compare number with nil HOT 2
- Part after dot is ignored HOT 2
- How to add description of example script HOT 1
- @type changes behavior when used in @submodule HOT 5
- LuaRocks module: broken link to project homepage HOT 2
- How to use @script tag? HOT 2
- Filename case issues for cross-platform document generation HOT 5
- --fatalwarnings returns 0 exit code with invalid Markdown references
- LDoc breaks when loading config file. HOT 2
- [Meta] Is this repo dead? HOT 2
- How do I ignore certain files/directories? HOT 2
- `hxx` extension support HOT 2
- multiple raise statements cause error HOT 6
- Support nested subparams HOT 2
- Question: is there a way to generate document from lua-language-server type annotations?
- Add LuaCATS as alternative tag handling scheme HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ldoc.