[luatex] Lua API for the Language Server Protocol (LSP)

Josef Friedrich josef at friedrich.rocks
Fri Jan 6 10:42:05 CET 2023


The preferred method of contributing to the project is via Github pull
requests. You can also email patches to josef at friedrich.rocks.
It is ok if you only document the data types of the input parameters.

# Minimal example of `tex.sp()`

---
--- at param s string
function tex.sp(s) end

# Less minimal example of `tex.sp()`

---
--- at param s string
---
--- at return integer
function tex.sp(s) end


Or if you have more time you can also expand the documentation to this
level:

# Prime example of `tex.sp()`

---
---Convert a string `s` that represents an explicit
---dimension into an integer number of scaled points.
---
---For parsing the string, the same scanning and conversion rules are 
used that
---*LuaTeX* would use if it was scanning a dimension specifier in its 
*TeX*-like
---input language (this includes generating errors for bad values), 
expect for the
---following:
---
---* only explicit values are allowed, control sequences are not handled
---* infinite dimension units (`fil...`) are forbidden
---* `mu` units do not generate an error (but may not be useful either)
---
---__Example:__
---
---```lua
---local scaled_points = tex.sp('1cm')
---print(scaled_points) -- 1864679
---```
---
---__Reference:__
---
---* `LuaTeX` manual: 10.3.15.5 `sp` page 204
---* Source code of the `LuaTeX` manual: 
[luatex-tex.tex#L1386-L1413](https://github.com/TeX-Live/luatex/blob/3f14129c06359e1a06dd2f305c8334a2964149d3/manual/luatex-tex.tex#L1386-L1413)
---
--- at param s string # A string to convert into scaled points.
---
--- at return integer # The dimension in the scaled points format.
function tex.sp(s) end



More information about the luatex mailing list.