diff --git a/LICENSE b/LICENSE index f8fd122cea603d74b2c9b0d11f2cf7728ed02bf3..a8516e57591da66b9d7f9a0cd11c5a0c2987d2a8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Xavier Bergeron +Copyright (c) 2019-2020 Xavier Bergeron Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 739159170d5561244a23ce5ec5b302bdc94bfd9c..e67b23333526090d89d942562b7e9feda25db5cc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # XLIB A collection of snippets and tools for Garry's Mod development. (Short for Xavier's Library) -*TODO: LDoc documentation. This library is mostly limited to internal use, but is a dependency for some of my future releases.* +> GLDoc documentation is currently underway. View [./docs/](./docs/index.html) It is currently not hosted anywhere but will be put on GH pages once more documentation is written. +> Feel free to submit any pull requests to improve the documentation! - [XLIB](#xlib) @@ -217,9 +218,16 @@ schema "sample" -- Support for function-based migration for additional logic migration (3) (function(db, callback) db() - :queryraw("SELECT VERSION() AS `version`") + :queryraw([[ + SELECT EXISTS ( + SELECT * FROM `INFORMATION_SCHEMA`.`SESSION_STATUS` + WHERE VARIABLE_NAME = 'FEATURE_SYSTEM_VERSIONING' + ) AS support; + ]]) :result(function(q, row) - if row.version:lower():find("mariadb") then + -- This particular check could be done with pure SQL + -- But this is for demonstration purposes + if row.support == 1 then return "alter" end end) @@ -253,6 +261,7 @@ function SAMPLEDB:InitPlayer(ply) -- Initiate a query chain DB.sample() -- Add a sequential query to the chain + -- If your query returns more than one row, use queryall instead :query(DB.sample.players.get(steamid)) :result(function(q, row) -- Return next_action, vararg parameters. diff --git a/config.ld b/config.ld new file mode 100644 index 0000000000000000000000000000000000000000..d1c3ec108961268fb86408fd01251dfc4aebea51 --- /dev/null +++ b/config.ld @@ -0,0 +1,18 @@ +project="Xavier's Library" +title="Xavier's Library" +description=[[A collection of snippets and tools for Garry's Mod development. (Short for Xavier's Library) +Documentation is a work-in progress. Pull requests are welcome! Docs are generated with LDoc. +]] +format="markdown" +file={ + "lua/xlib/", + "lua/includes/", + exclude={ + "lua/xlib/thirdparty/sh_rxlua.lua", + }, +} +dir="docs" +not_luadoc=true +merge=true +style=true -- use ./ldoc.css +template=true -- use ./ldoc.ltp \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000000000000000000000000000000000000..457f2121cfe8e03bd7ad5d9c397b52ea04ec99d4 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,90 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Xavier's Library</title> + <link rel="stylesheet" href="ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Xavier's Library</h1> + + + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="modules/xui.html">xui</a></li> + <li><a href="modules/xlib.utils.html">xlib.utils</a></li> + <li><a href="modules/lpeg.html">lpeg</a></li> + <li><a href="modules/credentialstore.html">credentialstore</a></li> + <li><a href="modules/XLIB.html">XLIB</a></li> + <li><a href="modules/sentry.html">sentry</a></li> +</ul> + +</div> + +<div id="content"> + + + <h2>A collection of snippets and tools for Garry's Mod development. (Short for Xavier's Library) +Documentation is a work-in progress. Pull requests are welcome! Docs are generated with LDoc.</h2> + +<h2>Modules</h2> +<table class="module_list"> + <tr> + <td class="name" nowrap><a href="modules/xui.html">xui</a></td> + <td class="summary">(no description)</td> + </tr> + <tr> + <td class="name" nowrap><a href="modules/xlib.utils.html">xlib.utils</a></td> + <td class="summary"> + +</td> + </tr> + <tr> + <td class="name" nowrap><a href="modules/lpeg.html">lpeg</a></td> + <td class="summary">LuLPeg, a pure Lua port of LPeg, Roberto Ierusalimschy's Parsing Expression Grammars library.</td> + </tr> + <tr> + <td class="name" nowrap><a href="modules/credentialstore.html">credentialstore</a></td> + <td class="summary">(no description)</td> + </tr> + <tr> + <td class="name" nowrap><a href="modules/XLIB.html">XLIB</a></td> + <td class="summary">Xavier's Library</p> + +<p> This documentation is a work-in-progress.</td> + </tr> + <tr> + <td class="name" nowrap><a href="modules/sentry.html">sentry</a></td> + <td class="summary">Provides an interface to <a href="https://sentry.io">Sentry</a> from GLua</td> + </tr> +</table> + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="https://github.com/xaviergmail/GLDoc">GLDoc 1.4.6-GLua</a></i> +<i style="float:right;">Last updated 2020-08-06 21:59:36 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/docs/ldoc.css b/docs/ldoc.css new file mode 100644 index 0000000000000000000000000000000000000000..b8863b6f7ce4dd015fd27408f5ef988303e0e263 --- /dev/null +++ b/docs/ldoc.css @@ -0,0 +1,339 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #cccccc; + background: #2d2d2d; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + + + +body { + font-family: arial, helvetica, geneva, sans-serif; + /*background-color: #494949;*/ + margin: 0px; + color: #e6e6e6; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} +li strong { text-decoration: underline; } +dt strong { color: #FFFFFF; font-family: monospace; font-size: 1.6em; } + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 0 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #6699cc; text-decoration: none; } +a:visited { font-weight: bold; color: #4b87c3; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +.name a { + color: #4b87c3; +} + +h2 a { + text-decoration: underline !important; +} + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre { + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + +pre.example { + font-size: .85em; +} + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + /* background-color: #2d2d2d ; */ +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + /* background-color: #2d2d2d ; */ +} + +#product big { + font-size: 2em; +} + +#main { + background-color:#404040 ; + /* border-left: 1px solid #cccccc; */ +} + +#navigation { + position: fixed; + top: 0; + left: 0; + float: left; + width: 14em; + vertical-align: top; + background-color:#2d2d2d; + /* border-right: 2px solid #cccccc; */ + overflow: visible; + overflow-y: scroll; + height: 100%; + padding-left: 1em; +} + +#navigation h2 { + /* background-color:#FFFFFF;:#e7e7e7; */ + font-size:1.1em; + color:#cccccc; + text-align: left; + padding:0.2em; + border-bottom:1px solid #515151; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + padding-left: 2em; + width: 700px; + border-left: 2px solid #515151; + /*border-right: 2px solid #cccccc*/; + /* background-color: #2d2d2d; */ +} + +#about { + clear: both; + padding-left: 2em; + padding-right: 1em; + margin-left: 14em; + border-top: 2px solid #515151; + border-left: 2px solid #515151; + background-color: #2d2d2d; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #6699cc; text-decoration: underline; } + + #main { + background-color: #2d2d2d; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + /* background-color: #2d2d2d; */ + } + + #content { + padding: 1em; + /* background-color: #2d2d2d; */ + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #515151; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #515151; +} +table.module_list td.name { background-color: #393939; ; min-width: 200px; } +table.module_list td.summary { width: 100%; } + +code { + font-family: monospace; + background-color: #4e4e4e; + padding: 4px; +} + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #515151; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #515151; +} +table.function_list td.name { background-color: #393939; ; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +dl.table dt, dl.function dt {border-top: 1px solid #515151; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +ul.nowrap { + overflow:auto; + whitespace:nowrap; +} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #515151; + padding: 3px; +} + +::selection { + background: #515151; +} + +pre { + border: 1px solid #1d1d1d; + background: #2d2d2d; +} + +pre.warn { + border: 1px solid hsl(0 56% 15% / 1); + background: hsl(0 34% 32% / 1); + font-family: arial; +} + +pre .comment { color: #999999; } +pre .constant { color: #f99157; } +pre .escape { color: #f99157; } +pre .keyword { color: #cc99cc; font-weight: bold; } +pre .library { color: #6699cc; } +pre .marker { color: #393939; background: #ffcc66 ; font-weight: bold; } +pre .string { color: #99cc99; } +pre .number { color: #f99157; } +pre .operator { color: #ffcc66; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #999999; } +pre .global { color: #6699cc; } +pre .user-keyword { color: #ffcc66 ; } +pre .prompt { color: #f99157; } +pre .url { color: #66cccc; text-decoration: underline; } \ No newline at end of file diff --git a/docs/modules/XLIB.html b/docs/modules/XLIB.html new file mode 100644 index 0000000000000000000000000000000000000000..37c42daecb19e321e93b6a25c690ca2b8140e6af --- /dev/null +++ b/docs/modules/XLIB.html @@ -0,0 +1,72 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Xavier's Library</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Xavier's Library</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/xui.html">xui</a></li> + <li><a href="../modules/xlib.utils.html">xlib.utils</a></li> + <li><a href="../modules/lpeg.html">lpeg</a></li> + <li><a href="../modules/credentialstore.html">credentialstore</a></li> + <li><strong>XLIB</strong></li> + <li><a href="../modules/sentry.html">sentry</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>XLIB</code></h1> +<p>Xavier's Library</p> + +<p> This documentation is a work-in-progress.</p> +<p> Feel free to submit a pull + request if you'd like to contribute to it! The documentation uses LDoc.</p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="https://github.com/xaviergmail/GLDoc">GLDoc 1.4.6-GLua</a></i> +<i style="float:right;">Last updated 2020-08-06 21:59:36 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/docs/modules/credentialstore.html b/docs/modules/credentialstore.html new file mode 100644 index 0000000000000000000000000000000000000000..1185765ae15bb5e90058fc66ba5dbbbc4b81ffe2 --- /dev/null +++ b/docs/modules/credentialstore.html @@ -0,0 +1,71 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Xavier's Library</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Xavier's Library</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/xui.html">xui</a></li> + <li><a href="../modules/xlib.utils.html">xlib.utils</a></li> + <li><a href="../modules/lpeg.html">lpeg</a></li> + <li><strong>credentialstore</strong></li> + <li><a href="../modules/XLIB.html">XLIB</a></li> + <li><a href="../modules/sentry.html">sentry</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>credentialstore</code></h1> +<p>(no description)</p> +<p> + +</p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="https://github.com/xaviergmail/GLDoc">GLDoc 1.4.6-GLua</a></i> +<i style="float:right;">Last updated 2020-08-06 21:59:36 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/docs/modules/lpeg.html b/docs/modules/lpeg.html new file mode 100644 index 0000000000000000000000000000000000000000..15a5c224b9751dce989f501273fbc7ea6c9d9909 --- /dev/null +++ b/docs/modules/lpeg.html @@ -0,0 +1,73 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Xavier's Library</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Xavier's Library</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/xui.html">xui</a></li> + <li><a href="../modules/xlib.utils.html">xlib.utils</a></li> + <li><strong>lpeg</strong></li> + <li><a href="../modules/credentialstore.html">credentialstore</a></li> + <li><a href="../modules/XLIB.html">XLIB</a></li> + <li><a href="../modules/sentry.html">sentry</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>lpeg</code></h1> +<p>LuLPeg, a pure Lua port of LPeg, Roberto Ierusalimschy's Parsing Expression Grammars library.</p> +<p> See <a href="http://www.inf.puc-rio.br/~roberto/lpeg/">http://www.inf.puc-rio.br/~roberto/lpeg/</a> for the original documentation</p> + +<p> Copyright (C) Pierre-Yves Gerardy. + Released under the Romantic WTF Public License (cf. the LICENSE + file or the end of this file, whichever is present).</p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="https://github.com/xaviergmail/GLDoc">GLDoc 1.4.6-GLua</a></i> +<i style="float:right;">Last updated 2020-08-06 21:59:36 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/docs/modules/sentry.html b/docs/modules/sentry.html new file mode 100644 index 0000000000000000000000000000000000000000..b52fca9ec25082d5f548e289aa2a4237c621b791 --- /dev/null +++ b/docs/modules/sentry.html @@ -0,0 +1,595 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Xavier's Library</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Xavier's Library</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#Tables">Tables</a></li> +<li><a href="#util">util</a></li> +<li><a href="#Transactions">Transactions</a></li> +</ul> + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/xui.html">xui</a></li> + <li><a href="../modules/xlib.utils.html">xlib.utils</a></li> + <li><a href="../modules/lpeg.html">lpeg</a></li> + <li><a href="../modules/credentialstore.html">credentialstore</a></li> + <li><a href="../modules/XLIB.html">XLIB</a></li> + <li><strong>sentry</strong></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>sentry</code></h1> +<p>Provides an interface to <a href="https://sentry.io">Sentry</a> from GLua</p> +<p> <a href="https://github.com/lexicality/gmod-sentry/">Github Page</a></p> + <h3>Info:</h3> + <ul> + <li><strong>Copyright</strong>: 2018 Lex Robinson</li> + <li><strong>Author</strong>: Lex Robinson</li> + </ul> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#CaptureException">CaptureException (err, extra)</a></td> + <td class="summary">Captures an exception for sentry, using the current stack as the error's stack + Most useful inside an xpcall handler</td> + </tr> + <tr> + <td class="name" nowrap><a href="#pcall">pcall ([extra], func, ...)</a></td> + <td class="summary">Works like <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pcall">normal pcall</a> + but uploads the error to Sentry as well as returning it</td> + </tr> + <tr> + <td class="name" nowrap><a href="#ExecuteInTransaction">ExecuteInTransaction ([name][, txn], func, ...)</a></td> + <td class="summary">Executes a function in transaction context.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#EnableLuaerrorDetours">EnableLuaerrorDetours ()</a></td> + <td class="summary">Enables all gm_luaerror detours</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Setup">Setup (dsn[, extra])</a></td> + <td class="summary">Configures and activates Sentry</td> + </tr> +</table> +<h2><a href="#Tables">Tables</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#DetectedModules">DetectedModules</a></td> + <td class="summary">All the modules Sentry has detected.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#DetectionFuncs">DetectionFuncs</a></td> + <td class="summary">More complex ways of detecting a module's version</td> + </tr> +</table> +<h2><a href="#util">util</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#ISODate">ISODate (time)</a></td> + <td class="summary">Generates an ISO 8601/RFC 6350 formatted date</td> + </tr> + <tr> + <td class="name" nowrap><a href="#GetOSName">GetOSName (extra)</a></td> + <td class="summary">Generates a pretty printed name of the current operating sytem</td> + </tr> +</table> +<h2><a href="#Transactions">Transactions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#IsInTransaction">IsInTransaction ()</a></td> + <td class="summary">Checks if Sentry thinks a transaction is active + Ideally true, but could be false if an undetoured entrypoint is used</td> + </tr> + <tr> + <td class="name" nowrap><a href="#ExecuteTransaction">ExecuteTransaction (name, txn, func, ...)</a></td> + <td class="summary">[INTERNAL] Executes a function in transaction context</td> + </tr> + <tr> + <td class="name" nowrap><a href="#MergeContext">MergeContext (data)</a></td> + <td class="summary">Add data to the current transaction's context.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#ClearContext">ClearContext ()</a></td> + <td class="summary">Remove any extra data from the current transaction.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#TagsContext">TagsContext (tags)</a></td> + <td class="summary">Merge tags into the current transaction's context + Does nothing if no transaction is active</td> + </tr> + <tr> + <td class="name" nowrap><a href="#ExtraContext">ExtraContext (tags)</a></td> + <td class="summary">Merge the extra field into the current transaction's context + Does nothing if no transaction is active</td> + </tr> + <tr> + <td class="name" nowrap><a href="#UserContext">UserContext (user)</a></td> + <td class="summary">Set the current player for this context + Does nothing if no transaction is active</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "CaptureException"></a> + <strong>CaptureException (err, extra)</strong> + </dt> + <dd> + Captures an exception for sentry, using the current stack as the error's stack + Most useful inside an xpcall handler + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">err</span> + The raw Lua error that happened, with or without file details + </li> + <li><span class="parameter">extra</span> + Any other information about the error to upload to Sentry with it + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + The generated error's ID or nil if it was automatically discarded + </ol> + + + + +</dd> + <dt> + <a name = "pcall"></a> + <strong>pcall ([extra], func, ...)</strong> + </dt> + <dd> + Works like <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pcall">normal pcall</a> + but uploads the error to Sentry as well as returning it + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">extra</span> + Other info to send to the server if func errors + (<em>optional</em>) + </li> + <li><span class="parameter">func</span> + The function to pcall + </li> + <li><span class="parameter">...</span> + Arguments to pass to func + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message. + </ol> + + + + +</dd> + <dt> + <a name = "ExecuteInTransaction"></a> + <strong>ExecuteInTransaction ([name][, txn], func, ...)</strong> + </dt> + <dd> + Executes a function in transaction context. + If the function throws an error, the error will be reported to sentry and then will be re-raised. + If you don't want the error re-raised, use sentry.pcall + Both name and txn are optional + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + The name of the transaction or nil if not applicable + (<em>optional</em>) + </li> + <li><span class="parameter">txn</span> + The data to attach to the transaction + (<em>optional</em>) + </li> + <li><span class="parameter">func</span> + The function to execute + </li> + <li><span class="parameter">...</span> + Arguments to pass to the function + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + Whatever func returns + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">sentry.ExecuteInTransaction(<span class="string">"My Thing"</span>, mything)</pre></li> + <li><pre class="example">sentry.ExecuteInTransaction({ tags = { mything = <span class="string">"awesome"</span>} }, mything)</pre></li> + </ul> + +</dd> + <dt> + <a name = "EnableLuaerrorDetours"></a> + <strong>EnableLuaerrorDetours ()</strong> + </dt> + <dd> + Enables all gm_luaerror detours + + + + + + + +</dd> + <dt> + <a name = "Setup"></a> + <strong>Setup (dsn[, extra])</strong> + </dt> + <dd> + Configures and activates Sentry + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">dsn</span> + The DSN sentry gave you when you set up your project + </li> + <li><span class="parameter">extra</span> + Additional config values to store in sentry. Valid keys <code>tags</code>, <code>release</code>, <code>environment</code>, <code>server_name</code>, <code>no_detour</code> + (<em>optional</em>) + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">sentry.Setup(<span class="string">"https://key@sentry.io/1337"</span>, {server_name=<span class="string">"server 7"</span>, release=<span class="string">"v23"</span>, environment=<span class="string">"production"</span>})</pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="Tables"></a>Tables</h2> + + <dl class="function"> + <dt> + <a name = "DetectedModules"></a> + <strong>DetectedModules</strong> + </dt> + <dd> + All the modules Sentry has detected. + Anything added to this will also be sent to Sentry + + + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">sentry.DetectedModules[<span class="string">"foo"</span>] = <span class="string">"7.2"</span></pre> + </ul> + +</dd> + <dt> + <a name = "DetectionFuncs"></a> + <strong>DetectionFuncs</strong> + </dt> + <dd> + More complex ways of detecting a module's version + + + <h3>Fields:</h3> + <ul> + <li><span class="parameter">func</span> + + + + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">sentry.DetectionFuncs[<span class="string">"global name"</span>] = <span class="keyword">function</span>(global_value) <span class="keyword">return</span> <span class="string">"version"</span>, <span class="string">"optional override name"</span> <span class="keyword">end</span></pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="util"></a>util</h2> + + <dl class="function"> + <dt> + <a name = "ISODate"></a> + <strong>ISODate (time)</strong> + </dt> + <dd> + Generates an ISO 8601/RFC 6350 formatted date + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">time</span> + The unix timestamp to generate the date from + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + The date string + </ol> + + + + +</dd> + <dt> + <a name = "GetOSName"></a> + <strong>GetOSName (extra)</strong> + </dt> + <dd> + Generates a pretty printed name of the current operating sytem + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">extra</span> + + + + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + "Windows", "macOS", "Linux" or nil. + </ol> + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Transactions"></a>Transactions</h2> + + <dl class="function"> + <dt> + <a name = "IsInTransaction"></a> + <strong>IsInTransaction ()</strong> + </dt> + <dd> + Checks if Sentry thinks a transaction is active + Ideally true, but could be false if an undetoured entrypoint is used + + + + <h3>Returns:</h3> + <ol> + + true or false + </ol> + + + + +</dd> + <dt> + <a name = "ExecuteTransaction"></a> + <strong>ExecuteTransaction (name, txn, func, ...)</strong> + </dt> + <dd> + [INTERNAL] Executes a function in transaction context + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + The name of the transaction or nil if not applicable + </li> + <li><span class="parameter">txn</span> + The data to attach to the transaction + </li> + <li><span class="parameter">func</span> + The function to execute + </li> + <li><span class="parameter">...</span> + Arguments to pass to the function + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + Whatever func returns + </ol> + + + + +</dd> + <dt> + <a name = "MergeContext"></a> + <strong>MergeContext (data)</strong> + </dt> + <dd> + Add data to the current transaction's context. + Anything here will override the transaction's starting values + Does nothing if no transaction is active + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">data</span> + Data to add + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">sentry.MergeContext({ culprit = <span class="string">"your mum"</span> })</pre> + </ul> + +</dd> + <dt> + <a name = "ClearContext"></a> + <strong>ClearContext ()</strong> + </dt> + <dd> + Remove any extra data from the current transaction. + Does not affect the data the transaction was started with. + Does nothing if no transaction is active + + + + + + + +</dd> + <dt> + <a name = "TagsContext"></a> + <strong>TagsContext (tags)</strong> + </dt> + <dd> + Merge tags into the current transaction's context + Does nothing if no transaction is active + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tags</span> + A table of tag names as keys, values as values + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">sentry.TagsContext({ somecondition = <span class="string">"passed"</span> })</pre> + </ul> + +</dd> + <dt> + <a name = "ExtraContext"></a> + <strong>ExtraContext (tags)</strong> + </dt> + <dd> + Merge the extra field into the current transaction's context + Does nothing if no transaction is active + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tags</span> + A table of arbitrary data to send to Sentry + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">sentry.ExtraContext({ numplayers = <span class="number">23</span> })</pre> + </ul> + +</dd> + <dt> + <a name = "UserContext"></a> + <strong>UserContext (user)</strong> + </dt> + <dd> + Set the current player for this context + Does nothing if no transaction is active + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">user</span> + A player object + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">sentry.UserContext(ply)</pre> + </ul> + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="https://github.com/xaviergmail/GLDoc">GLDoc 1.4.6-GLua</a></i> +<i style="float:right;">Last updated 2020-08-06 21:59:36 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/docs/modules/xlib.utils.html b/docs/modules/xlib.utils.html new file mode 100644 index 0000000000000000000000000000000000000000..43e94000d42d40f91ca55b57de378f447a9d72bf --- /dev/null +++ b/docs/modules/xlib.utils.html @@ -0,0 +1,287 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Xavier's Library</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Xavier's Library</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/xui.html">xui</a></li> + <li><strong>xlib.utils</strong></li> + <li><a href="../modules/lpeg.html">lpeg</a></li> + <li><a href="../modules/credentialstore.html">credentialstore</a></li> + <li><a href="../modules/XLIB.html">XLIB</a></li> + <li><a href="../modules/sentry.html">sentry</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>xlib.utils</code></h1> +<p> + +</p> +<p> A set of useful utility functions that don't fit into a category of their own.</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#XLIB.tonumber">XLIB.tonumber (str)</a></td> + <td class="summary">Integer-safe tonumber</td> + </tr> + <tr> + <td class="name" nowrap><a href="#XLIB.FreezeProp">XLIB.FreezeProp (ent)</a></td> + <td class="summary">Freezes an entity in place</td> + </tr> + <tr> + <td class="name" nowrap><a href="#XLIB.ColorToInt">XLIB.ColorToInt (color)</a></td> + <td class="summary">Serializes a Color object into an integer</td> + </tr> + <tr> + <td class="name" nowrap><a href="#XLIB.IntToColor">XLIB.IntToColor (int)</a></td> + <td class="summary">Deserializes an integer into a Color object</td> + </tr> + <tr> + <td class="name" nowrap><a href="#XLIB.SafeColor">XLIB.SafeColor (color, noalpha)</a></td> + <td class="summary">Clamps all values of a color object between 0-255</td> + </tr> + <tr> + <td class="name" nowrap><a href="#XLIB.SafeColorNoAlpha">XLIB.SafeColorNoAlpha (color)</a></td> + <td class="summary">Shortcut for XLIB.SafeColor(..., true)</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "XLIB.tonumber"></a> + <strong>XLIB.tonumber (str)</strong> + </dt> + <dd> + Integer-safe tonumber This function will return nil if the number to be converted + exceeds the integer-definable range of IEEE 754 doubles + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">str</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + String to be converted to number + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">number</span></span> + The converted number, if the conversion is safe + </ol> + <h3>Or</h3> + <ol> + + <span class="types"><span class="type">nil</span></span> + Nil if the conversion would lose integer precision + </ol> + + + + +</dd> + <dt> + <a name = "XLIB.FreezeProp"></a> + <strong>XLIB.FreezeProp (ent)</strong> + </dt> + <dd> + Freezes an entity in place This sets the entity's movetype to <code>MOVETYPE_NONE</code> and disables + motion on its physics object in order to avoid clientside prediction errors. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">ent</span> + <span class="types"><span class="type">Entity</span></span> + Entity to freeze + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "XLIB.ColorToInt"></a> + <strong>XLIB.ColorToInt (color)</strong> + </dt> + <dd> + Serializes a Color object into an integer This is a useful way to store a Color object in binary format + as it only uses one double, opposed to 4 (Or god forbid a String) + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">color</span> + <span class="types"><span class="type">Color</span></span> + Color to convert to an int + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">number</span></span> + The color object represented as an integer + </ol> + + + + +</dd> + <dt> + <a name = "XLIB.IntToColor"></a> + <strong>XLIB.IntToColor (int)</strong> + </dt> + <dd> + Deserializes an integer into a Color object + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">int</span> + <span class="types"><span class="type">number</span></span> + Integer to convert to a Color object + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">Color</span></span> + + + + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../modules/xlib.utils.html#XLIB.ColorToInt">XLIB.ColorToInt</a> + </ul> + + +</dd> + <dt> + <a name = "XLIB.SafeColor"></a> + <strong>XLIB.SafeColor (color, noalpha)</strong> + </dt> + <dd> + Clamps all values of a color object between 0-255 + + <h3>Warning:</h3> + <ul> + <pre class="warn">This modifies the color object passed to it rather than creating a copy!</pre> + </ul> + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">color</span> + <span class="types"><span class="type">Color</span></span> + The color object to clamp + </li> + <li><span class="parameter">noalpha</span> + <span class="types"><span class="type">bool[opt=false]</span></span> + Forces the alpha channel to 255 if true + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">Color</span></span> + The color object passed as the first argument + </ol> + + + + +</dd> + <dt> + <a name = "XLIB.SafeColorNoAlpha"></a> + <strong>XLIB.SafeColorNoAlpha (color)</strong> + </dt> + <dd> + Shortcut for XLIB.SafeColor(..., true) Clamps all the values of a color object between 0-255 and forces the alpha to 255 + + <h3>Warning:</h3> + <ul> + <pre class="warn">This modifies the color object passed to it rather than creating a copy!</pre> + </ul> + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">color</span> + <span class="types"><span class="type">Color</span></span> + The color object to clamp + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../modules/xlib.utils.html#XLIB.SafeColor">XLIB.SafeColor</a> + </ul> + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="https://github.com/xaviergmail/GLDoc">GLDoc 1.4.6-GLua</a></i> +<i style="float:right;">Last updated 2020-08-06 21:59:36 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/docs/modules/xui.html b/docs/modules/xui.html new file mode 100644 index 0000000000000000000000000000000000000000..66bd8916981b3637138b0c9ad070e882f6885563 --- /dev/null +++ b/docs/modules/xui.html @@ -0,0 +1,71 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Xavier's Library</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Xavier's Library</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><strong>xui</strong></li> + <li><a href="../modules/xlib.utils.html">xlib.utils</a></li> + <li><a href="../modules/lpeg.html">lpeg</a></li> + <li><a href="../modules/credentialstore.html">credentialstore</a></li> + <li><a href="../modules/XLIB.html">XLIB</a></li> + <li><a href="../modules/sentry.html">sentry</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>xui</code></h1> +<p>(no description)</p> +<p> + +</p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="https://github.com/xaviergmail/GLDoc">GLDoc 1.4.6-GLua</a></i> +<i style="float:right;">Last updated 2020-08-06 21:59:36 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/ldoc.css b/ldoc.css new file mode 100644 index 0000000000000000000000000000000000000000..b8863b6f7ce4dd015fd27408f5ef988303e0e263 --- /dev/null +++ b/ldoc.css @@ -0,0 +1,339 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #cccccc; + background: #2d2d2d; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + + + +body { + font-family: arial, helvetica, geneva, sans-serif; + /*background-color: #494949;*/ + margin: 0px; + color: #e6e6e6; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} +li strong { text-decoration: underline; } +dt strong { color: #FFFFFF; font-family: monospace; font-size: 1.6em; } + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 0 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #6699cc; text-decoration: none; } +a:visited { font-weight: bold; color: #4b87c3; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +.name a { + color: #4b87c3; +} + +h2 a { + text-decoration: underline !important; +} + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre { + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + +pre.example { + font-size: .85em; +} + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + /* background-color: #2d2d2d ; */ +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + /* background-color: #2d2d2d ; */ +} + +#product big { + font-size: 2em; +} + +#main { + background-color:#404040 ; + /* border-left: 1px solid #cccccc; */ +} + +#navigation { + position: fixed; + top: 0; + left: 0; + float: left; + width: 14em; + vertical-align: top; + background-color:#2d2d2d; + /* border-right: 2px solid #cccccc; */ + overflow: visible; + overflow-y: scroll; + height: 100%; + padding-left: 1em; +} + +#navigation h2 { + /* background-color:#FFFFFF;:#e7e7e7; */ + font-size:1.1em; + color:#cccccc; + text-align: left; + padding:0.2em; + border-bottom:1px solid #515151; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + padding-left: 2em; + width: 700px; + border-left: 2px solid #515151; + /*border-right: 2px solid #cccccc*/; + /* background-color: #2d2d2d; */ +} + +#about { + clear: both; + padding-left: 2em; + padding-right: 1em; + margin-left: 14em; + border-top: 2px solid #515151; + border-left: 2px solid #515151; + background-color: #2d2d2d; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #6699cc; text-decoration: underline; } + + #main { + background-color: #2d2d2d; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + /* background-color: #2d2d2d; */ + } + + #content { + padding: 1em; + /* background-color: #2d2d2d; */ + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #515151; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #515151; +} +table.module_list td.name { background-color: #393939; ; min-width: 200px; } +table.module_list td.summary { width: 100%; } + +code { + font-family: monospace; + background-color: #4e4e4e; + padding: 4px; +} + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #515151; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #515151; +} +table.function_list td.name { background-color: #393939; ; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +dl.table dt, dl.function dt {border-top: 1px solid #515151; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +ul.nowrap { + overflow:auto; + whitespace:nowrap; +} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #515151; + padding: 3px; +} + +::selection { + background: #515151; +} + +pre { + border: 1px solid #1d1d1d; + background: #2d2d2d; +} + +pre.warn { + border: 1px solid hsl(0 56% 15% / 1); + background: hsl(0 34% 32% / 1); + font-family: arial; +} + +pre .comment { color: #999999; } +pre .constant { color: #f99157; } +pre .escape { color: #f99157; } +pre .keyword { color: #cc99cc; font-weight: bold; } +pre .library { color: #6699cc; } +pre .marker { color: #393939; background: #ffcc66 ; font-weight: bold; } +pre .string { color: #99cc99; } +pre .number { color: #f99157; } +pre .operator { color: #ffcc66; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #999999; } +pre .global { color: #6699cc; } +pre .user-keyword { color: #ffcc66 ; } +pre .prompt { color: #f99157; } +pre .url { color: #66cccc; text-decoration: underline; } \ No newline at end of file diff --git a/ldoc.ltp b/ldoc.ltp new file mode 100644 index 0000000000000000000000000000000000000000..720a80d88fdea9c547b0f07dd0d095bc57a9f30f --- /dev/null +++ b/ldoc.ltp @@ -0,0 +1,326 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=$(ldoc.doc_charset)"/> +<head> + <title>$(ldoc.title)</title> + <link rel="stylesheet" href="$(ldoc.css)" type="text/css" /> +# if ldoc.custom_css then -- add custom CSS file if configured. + <link rel="stylesheet" href="$(ldoc.custom_css)" type="text/css" /> +# end +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + +# local no_spaces = ldoc.no_spaces +# local use_li = ldoc.use_li +# local display_name = ldoc.display_name +# local iter = ldoc.modules.iter +# local function M(txt,item) return ldoc.markup(txt,item,ldoc.plain) end +# local nowrap = ldoc.wrap and '' or 'nowrap' + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>$(ldoc.project)</h1> + +# if not ldoc.single and module then -- reference back to project index +<ul> + <li><a href="../$(ldoc.output).html">Index</a></li> +</ul> +# end + +# --------- contents of module ------------- +# if module and not ldoc.no_summary and #module.items > 0 then +<h2>Contents</h2> +<ul> +# for kind,items in module.kinds() do +<li><a href="#$(no_spaces(kind))">$(kind)</a></li> +# end +</ul> +# end + + +# if ldoc.no_summary and module and not ldoc.one then -- bang out the functions on the side +# for kind, items in module.kinds() do +<h2>$(kind)</h2> +<ul class="nowrap"> +# for item in items() do + <li><a href="#$(item.name)">$(display_name(item))</a></li> +# end +</ul> +# end +# end +# -------- contents of project ---------- +# local this_mod = module and module.name +# for kind, mods, type in ldoc.kinds() do +# if ldoc.allowed_in_contents(type,module) then +<h2>$(kind)</h2> +<ul class="$(kind=='Topics' and '' or 'nowrap')"> +# for mod in mods() do local name = display_name(mod) +# if mod.name == this_mod then + <li><strong>$(name)</strong></li> +# else + <li><a href="$(ldoc.ref_to_module(mod))">$(name)</a></li> +# end +# end +# end +</ul> +# end + +</div> + +<div id="content"> + +# if ldoc.body then -- verbatim HTML as contents; 'non-code' entries + $(ldoc.body) +# elseif module then -- module documentation +<h1>$(ldoc.module_typename(module)) <code>$(module.name)</code></h1> +<p>$(M(module.summary,module))</p> +<p>$(M(module.description,module))</p> +# if module.tags.include then + $(M(ldoc.include_file(module.tags.include))) +# end +# if module.see then +# local li,il = use_li(module.see) + <h3>See also:</h3> + <ul> +# for see in iter(module.see) do + $(li)<a href="$(ldoc.href(see))">$(see.label)</a>$(il) +# end -- for + </ul> +# end -- if see +# if module.usage then +# local li,il = use_li(module.usage) + <h3>Usage:</h3> + <ul> +# for usage in iter(module.usage) do + $(li)<pre class="example">$(ldoc.escape(usage))</pre>$(il) +# end -- for + </ul> +# end -- if usage +# if module.info then + <h3>Info:</h3> + <ul> +# for tag, value in module.info:iter() do + <li><strong>$(tag)</strong>: $(M(value,module))</li> +# end + </ul> +# end -- if module.info + + +# if not ldoc.no_summary then +# -- bang out the tables of item types for this module (e.g Functions, Tables, etc) +# for kind,items in module.kinds() do +<h2><a href="#$(no_spaces(kind))">$(kind)</a></h2> +<table class="function_list"> +# for item in items() do + <tr> + <td class="name" $(nowrap)><a href="#$(item.name)">$(display_name(item))</a></td> + <td class="summary">$(M(item.summary,item))</td> + </tr> +# end -- for items +</table> +#end -- for kinds + +<br/> +<br/> + +#end -- if not no_summary + +# --- currently works for both Functions and Tables. The params field either contains +# --- function parameters or table fields. +# local show_return = not ldoc.no_return_or_parms +# local show_parms = show_return +# for kind, items in module.kinds() do +# local kitem = module.kinds:get_item(kind) +# local has_description = kitem and ldoc.descript(kitem) ~= "" + <h2 class="section-header $(has_description and 'has-description')"><a name="$(no_spaces(kind))"></a>$(kind)</h2> + $(M(module.kinds:get_section_description(kind),nil)) +# if kitem then +# if has_description then + <div class="section-description"> + $(M(ldoc.descript(kitem),kitem)) + </div> +# end +# if kitem.warn then + <h3>Warning:</h3> + <pre class="warn">$(ldoc.prettify(kitem.warn[1]))</pre> +# end +# if kitem.usage then + <h3>Usage:</h3> + <pre class="example">$(ldoc.prettify(kitem.usage[1]))</pre> +# end +# end + <dl class="function"> +# for item in items() do + <dt> + <a name = "$(item.name)"></a> + <strong>$(display_name(item))</strong> +# if ldoc.prettify_files and ldoc.is_file_prettified[item.module.file.filename] then + <a style="float:right;" href="$(ldoc.source_ref(item))">line $(item.lineno)</a> +# end + </dt> + <dd> + $(M(ldoc.descript(item),item)) + +# if ldoc.custom_tags then +# for custom in iter(ldoc.custom_tags) do +# local tag = item.tags[custom[1]] +# if tag and not custom.hidden then +# local li,il = use_li(tag) + <h3>$(custom.title or custom[1]):</h3> + <ul> +# for value in iter(tag) do + $(li)$(custom.format and custom.format(value) or M(value))$(il) +# end -- for +# end -- if tag + </ul> +# end -- iter tags +# end +# if item.warn then +# local li,il = use_li(item.warn) + <h3>Warning:</h3> + <ul> +# for warning in iter(item.warn) do + $(li)<pre class="warn">$(ldoc.prettify(warning))</pre>$(il) +# end -- for + </ul> +# end -- if warn + +# if show_parms and item.params and #item.params > 0 then +# local subnames = module.kinds:type_of(item).subnames +# if subnames then + <h3>$(subnames):</h3> +# end + <ul> +# for parm in iter(item.params) do +# local param,sublist = item:subparam(parm) +# if sublist then + <li><span class="parameter">$(sublist)</span>$(M(item.params.map[sublist],item)) + <ul> +# end +# for p in iter(param) do +# local name,tp,def = item:display_name_of(p), ldoc.typename(item:type_of_param(p)), item:default_of_param(p) + <li><span class="parameter">$(name)</span> +# if tp ~= '' then + <span class="types">$(tp)</span> +# end + $(M(item.params.map[p],item)) +# if def == true then + (<em>optional</em>) +# elseif def then + (<em>default</em> $(def)) +# end +# if item:readonly(p) then + <em>readonly</em> +# end + </li> +# end +# if sublist then + </li></ul> +# end +# end -- for + </ul> +# end -- if params + +# if show_return and item.retgroups then local groups = item.retgroups + <h3>Returns:</h3> +# for i,group in ldoc.ipairs(groups) do local li,il = use_li(group) + <ol> +# for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type) + $(li) +# if rt ~= '' then + <span class="types">$(rt)</span> +# end + $(M(r.text,item))$(il) +# if ctypes then + <ul> +# for c in ctypes:iter() do + <li><span class="parameter">$(c.name)</span> + <span class="types">$(ldoc.typename(c.type))</span> + $(M(c.comment,item))</li> +# end + </ul> +# end -- if ctypes +# end -- for r + </ol> +# if i < #groups then + <h3>Or</h3> +# end +# end -- for group +# end -- if returns + +# if show_return and item.raise then + <h3>Raises:</h3> + $(M(item.raise,item)) +# end + +# if item.see then +# local li,il = use_li(item.see) + <h3>See also:</h3> + <ul> +# for see in iter(item.see) do + $(li)<a href="$(ldoc.href(see))">$(see.label)</a>$(il) +# end -- for + </ul> +# end -- if see + +# if item.usage then +# local li,il = use_li(item.usage) + <h3>Usage:</h3> + <ul> +# for usage in iter(item.usage) do + $(li)<pre class="example">$(ldoc.prettify(usage))</pre>$(il) +# end -- for + </ul> +# end -- if usage + +</dd> +# end -- for items +</dl> +# end -- for kinds + +# else -- if module; project-level contents + +# if ldoc.description then + <h2>$(M(ldoc.description,nil))</h2> +# end +# if ldoc.full_description then + <p>$(M(ldoc.full_description,nil))</p> +# end + +# for kind, mods in ldoc.kinds() do +<h2>$(kind)</h2> +# kind = kind:lower() +<table class="module_list"> +# for m in mods() do + <tr> + <td class="name" $(nowrap)><a href="$(no_spaces(kind))/$(m.name).html">$(m.name)</a></td> + <td class="summary">$(M(ldoc.strip_header(m.summary),m))</td> + </tr> +# end -- for modules +</table> +# end -- for kinds +# end -- if module + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="https://github.com/xaviergmail/GLDoc">GLDoc $(ldoc.version)</a></i> +<i style="float:right;">Last updated $(ldoc.updatetime) </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/lua/includes/modules/gdbc.lua b/lua/includes/modules/gdbc.lua index a8fee59bb0b3f640467431936f24db251690e4bb..540f5f246fc6e34543fe674cbd47de91054f7221 100644 --- a/lua/includes/modules/gdbc.lua +++ b/lua/includes/modules/gdbc.lua @@ -100,12 +100,12 @@ function Query:onSuccess(result, last_insert) for k, v in pairs(result) do if istable(v) then for k2, v2 in pairs(v) do - if tonumber(v2) then - v[k2] = tonumber(v2) + if XLIB.tonumber_s(v2) then + v[k2] = XLIB.tonumber_s(v2) end end - elseif tonumber(v) then - result[k] = tonumber(v) + elseif XLIB.tonumber_s(v) then + result[k] = XLIB.tonumber_s(v) end end stop = self:checkProceed(self:result_callback(result, last_insert)) @@ -175,8 +175,8 @@ function Query:run(...) local t = TypeID(v) if t == table.NIL then query:setNull(k) - elseif tonumber(v) then - query:setNumber(k, tonumber(v)) + elseif XLIB.tonumber_s(v) then + query:setNumber(k, XLIB.tonumber_s(v)) elseif isbool(v) then query:setBool(k, v) elseif isstring(v) then diff --git a/lua/includes/modules/xlib.lua b/lua/includes/modules/xlib.lua index 5959be5283c2d4b6d4fcc12ca9bf67c64f7a9ec0..3fade8aae4db15a422c6e1d87fc8da6c8cb7862f 100644 --- a/lua/includes/modules/xlib.lua +++ b/lua/includes/modules/xlib.lua @@ -1,3 +1,10 @@ +--- Xavier's Library +-- +-- This documentation is a work-in-progress. Feel free to submit a pull +-- request if you'd like to contribute to it! The documentation uses LDoc. +-- @module XLIB + + AddCSLuaFile() _MODULES.xlib = true diff --git a/lua/includes/modules/xlib_sentry.lua b/lua/includes/modules/xlib_sentry.lua index e89729a40878f84f9c3e4f69c4ac98260dedf179..20187d630505e54d53b9f9fecfd2f8339a6c646f 100644 --- a/lua/includes/modules/xlib_sentry.lua +++ b/lua/includes/modules/xlib_sentry.lua @@ -157,12 +157,14 @@ end -- All the modules Sentry has detected. -- Anything added to this will also be sent to Sentry -- @usage sentry.DetectedModules["foo"] = "7.2" +-- @table DetectedModules DetectedModules = {}; --- -- More complex ways of detecting a module's version --- @field _ +-- @field func -- @usage sentry.DetectionFuncs["global name"] = function(global_value) return "version", "optional override name" end +-- @table DetectionFuncs DetectionFuncs = { mysqloo = function(mysqloo) return string.format("%d.%d", mysqloo.VERSION, mysqloo.MINOR_VERSION or 0); diff --git a/lua/xlib/netwrapper/cl_netwrapper.lua b/lua/xlib/netwrapper/cl_netwrapper.lua index 99ff5e530722aa221841e2b9f3fb95c26bafb95f..dfb6b2c934a5ed30d5c697cb5f0531e350d2466b 100644 --- a/lua/xlib/netwrapper/cl_netwrapper.lua +++ b/lua/xlib/netwrapper/cl_netwrapper.lua @@ -1,29 +1,29 @@ ---[[-------------------------------------------------------------------------- - File name: - cl_netwrapper.lua - - Authors: - Mista-Tea ([IJWTB] Thomas) - xaviergmail (Xavier Bergeron) - - License: - The MIT License (copy/modify/distribute freely!) - - Changelog: - - March 9th, 2014: Created - - April 5th, 2014: Added to GitHub - - August 15th, 2014: Added Net Requests - - April 25th, 2019: Added Net Hooks, Global Vars, Client Vars, Persistence +--[[ ------------------------------------------------------------------------- +-- File name: +-- cl_netwrapper.lua +-- +-- Authors: +-- Mista-Tea ([IJWTB] Thomas) +-- xaviergmail (Xavier Bergeron) +-- +-- License: +-- The MIT License (copy/modify/distribute freely!) +-- +-- Changelog: +-- - March 9th, 2014: Created +-- - April 5th, 2014: Added to GitHub +-- - August 15th, 2014: Added Net Requests +-- - April 25th, 2019: Added Net Hooks, Global Vars, Client Vars, Persistence ----------------------------------------------------------------------------]] ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Namespace Tables --------------------------------------------------------------------------]]-- netwrapper = netwrapper or {} netwrapper.requests = netwrapper.requests or {} ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Localized Functions & Variables --------------------------------------------------------------------------]]-- @@ -36,15 +36,15 @@ local GetConVarNumber = GetConVarNumber local ENTITY = FindMetaTable( "Entity" ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Namespace Functions --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- NET VARS --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Net - NetWrapperVar( entity, string, uint, * ) -- @@ -92,7 +92,7 @@ net.Receive( "NetWrapperVar", function( len ) end end ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Hook - InitPostEntity -- @@ -104,7 +104,7 @@ hook.Add( "InitPostEntity", "NetWrapperSync", function() net.SendToServer() end ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Hook - OnEntityCreated -- @@ -127,11 +127,11 @@ end ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- NET REQUESTS --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- ENTITY:SendNetRequest( key ) -- @@ -142,7 +142,7 @@ function ENTITY:SendNetRequest( key ) netwrapper.SendNetRequest( self:NWIndex(), key ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.SendNetRequest( number, string ) -- @@ -191,7 +191,7 @@ function netwrapper.SendNetRequest( id, key ) requests[ id ][ "NumRequests" ] = requests[ id ][ "NumRequests" ] + 1 end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Net - NetWrapperRequest -- @@ -209,7 +209,7 @@ net.Receive( "NetWrapperRequest", function( bits ) end ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Net - NetWrapperClear -- @@ -224,11 +224,11 @@ net.Receive( "NetWrapperClear", function( bits ) end ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- CLIENT VARS WRAPPER --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.SetClientVar( string, *, boolean [optional] ) -- @@ -238,7 +238,7 @@ function netwrapper.SetClientVar( key, value, force ) LocalPlayer():SetClientVar( key, value, force ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.GetClientVar( string, * ) -- @@ -248,7 +248,7 @@ function netwrapper.GetClientVar( key, default ) return LocalPlayer():GetClientVar( key, default ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.AddCLNetHook( string, string, function ) -- @@ -258,7 +258,7 @@ function netwrapper.AddCLNetHook( key, name, fn ) LocalPlayer():AddCLNetHook( key, name, fn ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.RemoveCLNetHook( string, string ) -- diff --git a/lua/xlib/netwrapper/example.lua b/lua/xlib/netwrapper/example.lua index b72a9008de799ee729ac78f996f9764f06826b35..6f30bf7ad9d0bac85d51b45cb2c88b966121c7dd 100644 --- a/lua/xlib/netwrapper/example.lua +++ b/lua/xlib/netwrapper/example.lua @@ -1,21 +1,19 @@ ---[[-------------------------------------------------------------------------- - File name: - example.lua - - Authors: - Mista-Tea ([IJWTB] Thomas) - xaviergmail (Xavier Bergeron) - - License: - The MIT License (copy/modify/distribute freely!) - - Changelog: - - March 9th, 2014: Created - - April 5th, 2014: Added to GitHub - - August 16th, 2014: Rewrote example for Net Vars / Net Requests - - April 25th, 2019: Added examples for Client Vars / Global Vars / Hooks - - +--[[ ------------------------------------------------------------------------- +-- File name: +-- example.lua +-- +-- Authors: +-- Mista-Tea ([IJWTB] Thomas) +-- xaviergmail (Xavier Bergeron) +-- +-- License: +-- The MIT License (copy/modify/distribute freely!) +-- +-- Changelog: +-- - March 9th, 2014: Created +-- - April 5th, 2014: Added to GitHub +-- - August 16th, 2014: Rewrote example for Net Vars / Net Requests +-- - April 25th, 2019: Added examples for Client Vars / Global Vars / Hooks ----------------------------------------------------------------------------]] -- In this example, we will assign a player's name to the prop they spawn in PlayerSpawnedProp. @@ -31,9 +29,9 @@ ---[[-------------------------------------------]]-- +--[[ ----------------------------------------- ]]-- -- Net Vars ---[[-------------------------------------------]]-- +--[[ ----------------------------------------- ]]-- -- Helper function for demo local function fmtHook( ent, key, value ) @@ -92,9 +90,9 @@ end ---[[-------------------------------------------]]-- +--[[ ----------------------------------------- ]]-- -- Net Requests ---[[-------------------------------------------]]-- +--[[ ----------------------------------------- ]]-- if ( SERVER ) then @@ -137,9 +135,9 @@ end ---[[-------------------------------------------]]-- +--[[ ----------------------------------------- ]]-- -- Global Variables ---[[-------------------------------------------]]-- +--[[ ----------------------------------------- ]]-- if ( SERVER ) then @@ -181,9 +179,9 @@ elseif ( CLIENT ) then end ---[[-------------------------------------------]]-- +--[[ ----------------------------------------- ]]-- -- ClientVars ---[[-------------------------------------------]]-- +--[[ ----------------------------------------- ]]-- if ( SERVER ) then diff --git a/lua/xlib/netwrapper/sh_netwrapper.lua b/lua/xlib/netwrapper/sh_netwrapper.lua index 9fdc16133aa53d173a35a3572f71961213e80909..c3d8244e092c643765d7cb5c0ce2db5fc1d0b146 100644 --- a/lua/xlib/netwrapper/sh_netwrapper.lua +++ b/lua/xlib/netwrapper/sh_netwrapper.lua @@ -1,24 +1,24 @@ ---[[-------------------------------------------------------------------------- - File name: - sh_netwrapper.lua - - Authors: - Mista-Tea ([IJWTB] Thomas) - xaviergmail (Xavier Bergeron) - - License: - The MIT License (copy/modify/distribute freely!) - - Changelog: - - March 9th, 2014: Created - - April 5th, 2014: Added to GitHub - - August 15th, 2014: Added Net Requests - - April 25th, 2019: Added Net Hooks, Global Vars, Client Vars, Persistence +--[[ ------------------------------------------------------------------------- +-- File name: +-- sh_netwrapper.lua +-- +-- Authors: +-- Mista-Tea ([IJWTB] Thomas) +-- xaviergmail (Xavier Bergeron) +-- +-- License: +-- The MIT License (copy/modify/distribute freely!) +-- +-- Changelog: +-- - March 9th, 2014: Created +-- - April 5th, 2014: Added to GitHub +-- - August 15th, 2014: Added Net Requests +-- - April 25th, 2019: Added Net Hooks, Global Vars, Client Vars, Persistence ----------------------------------------------------------------------------]] AddCSLuaFile() ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Namespace Tables --------------------------------------------------------------------------]]-- @@ -28,7 +28,7 @@ netwrapper.clients = netwrapper.clients or {} netwrapper.requests = netwrapper.requests or {} netwrapper.hooks = netwrapper.hooks or {} ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Localized Functions & Variables --------------------------------------------------------------------------]]-- @@ -83,15 +83,15 @@ function netwrapper.Entity(id) end end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Namespace Functions --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- NET VARS --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- ENTITY:SetNetVar( string, *, boolean [optional] ) -- @@ -122,7 +122,7 @@ function ENTITY:SetNetVar( key, value, force ) end end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- ENTITY:GetNetVar( string, * ) -- @@ -136,7 +136,7 @@ function ENTITY:GetNetVar( key, default ) if ( values[ key ] ~= nil ) then return values[ key ] else return default end end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- ENTITY:AddNetHook( string, string, function( entity, key, value ) ) -- @@ -147,7 +147,7 @@ function ENTITY:AddNetHook( key, name, fn ) netwrapper.StoreNetHook( self:NWIndex(), key, name, fn ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- ENTITY:AddNetHook( string, string ) -- @@ -157,7 +157,7 @@ function ENTITY:RemoveNetHook( key, name ) netwrapper.StoreNetHook( self:NWIndex(), key, name, nil ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.StoreNetVar( int, string, * ) -- @@ -175,7 +175,7 @@ function netwrapper.StoreNetVar( id, key, value ) netwrapper.NetVarChanged( -1, key, value, old, id ) -- Hack: use entity ID -1 as an all-inclusive hook end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.GetNetVars( id ) -- @@ -186,7 +186,7 @@ function netwrapper.GetNetVars( id ) return netwrapper.ents[ id ] or {} end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.StoreNetHook( int, string, string, function( entity, key, value ) ) -- @@ -198,7 +198,7 @@ function netwrapper.StoreNetHook( id, key, name, fn ) netwrapper.hooks[ id ][ key ][ name ] = fn end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.AddNetHook( string, string, function( entity, key, value ) ) -- @@ -210,7 +210,7 @@ function netwrapper.AddNetHook( key, name, fn ) netwrapper.StoreNetHook( -1, key, name, fn ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.RemoveNetHook( string, string ) -- @@ -220,7 +220,7 @@ function netwrapper.RemoveNetHook( key, name ) netwrapper.StoreNetHook( -1, key, name, nil ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.NetVarChanged( int, string, *, int, bool ) -- @@ -248,7 +248,7 @@ function netwrapper.NetVarChanged( id, key, value, old, realid, clvar ) end end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- CLIENT VARS -- Functionally identical to NetVars, but for players only, with the -- difference being that ClientVars are only networked to their respective @@ -256,7 +256,7 @@ end -- Example usage would be to network a player's health, money, inventory, etc. --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- PLAYER:SetClientVar( string, *, boolean [optional] ) -- @@ -274,7 +274,7 @@ function PLAYER:SetClientVar( key, value, force ) end end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- PLAYER:GetClientVar( string, * ) @@ -296,7 +296,7 @@ end -- identifiers to prevent clash between AddNetHook("Money") and AddCLNetHook("Money") netwrapper.CLNetHookPrefix = "ClientVar_" ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- PLAYER:AddCLNetHook( string, string, function( entity, key, value ) ) -- @@ -314,7 +314,7 @@ function PLAYER:AddCLNetHook( key, name, fn ) end end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- PLAYER:RemoveCLNetHook( string, string ) -- @@ -324,7 +324,7 @@ function PLAYER:RemoveCLNetHook( key, name ) netwrapper.StoreNetHook( self:NWIndex(), netwrapper.CLNetHookPrefix .. key, name, nil ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.AddCLNetHook( string, string, function( entity, key, value ) ) -- @@ -336,7 +336,7 @@ function netwrapper.AddCLNetHook( key, name, fn ) netwrapper.StoreNetHook( -1, netwrapper.CLNetHookPrefix .. key, name, fn ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.StoreClientVar( int, string, * ) -- @@ -354,7 +354,7 @@ function netwrapper.StoreClientVar( id, key, value ) netwrapper.NetVarChanged( -1, key, value, old, id, true ) -- Hack: use entity ID -1 as an all-inclusive hook end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.GetClientVars( id ) -- @@ -365,12 +365,12 @@ function netwrapper.GetClientVars( id ) return netwrapper.clients[ id ] or {} end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- GLOBAL NET VARS -- Wrapper around netvar functions applied on the game.GetWorld() entity --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.SetGlobalVar( string, *, boolean [optional] ) -- @@ -381,7 +381,7 @@ function netwrapper.SetGlobalVar( key, value, force ) game.GetWorld():SetNetVar( key, value, force ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.GetGlobalVar( string, * ) -- @@ -391,7 +391,7 @@ function netwrapper.GetGlobalVar( key, default ) return game.GetWorld():GetNetVar( key, default ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.AddGlobalHook( string, string, function( key, value ) ) -- @@ -401,7 +401,7 @@ function netwrapper.AddGlobalHook( key, name, fn ) game.GetWorld():AddNetHook( key, name, fn ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper:RemoveGlobalHook( string, string, function( key, value ) ) -- @@ -411,11 +411,11 @@ function netwrapper:RemoveGlobalHook( key, name ) game.GetWorld():RemoveNetHook( key, name ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- NET REQUESTS --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- ENTITY:SetNetRequest( string, * ) -- @@ -440,7 +440,7 @@ function ENTITY:SetNetRequest( key, value ) netwrapper.StoreNetRequest( self:NWIndex(), key, value ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- ENTITY:GetNetRequest( string, * ) -- @@ -454,7 +454,7 @@ function ENTITY:GetNetRequest( key, default ) if ( values[ key ] ~= nil ) then return values[ key ] else return default end end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.StoreNetRequest( number, string, * ) -- @@ -468,7 +468,7 @@ function netwrapper.StoreNetRequest( id, key, value ) netwrapper.requests[ id ][ key ] = value end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.GetNetRequests( number ) -- @@ -479,7 +479,7 @@ function netwrapper.GetNetRequests( id ) return netwrapper.requests[ id ] or {} end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.RemoveNetVars( number ) -- @@ -494,7 +494,7 @@ end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.ClearData( id ) -- diff --git a/lua/xlib/netwrapper/sv_netwrapper.lua b/lua/xlib/netwrapper/sv_netwrapper.lua index f390af63ea113b22678322a21f3821bba9f467f0..e1147695ace3631ceab151606b510fd801803391 100644 --- a/lua/xlib/netwrapper/sv_netwrapper.lua +++ b/lua/xlib/netwrapper/sv_netwrapper.lua @@ -1,22 +1,22 @@ ---[[-------------------------------------------------------------------------- - File name: - sv_netwrapper.lua - - Authors: - Mista-Tea ([IJWTB] Thomas) - xaviergmail (Xavier Bergeron) - - License: - The MIT License (copy/modify/distribute freely!) - - Changelog: - - March 9th, 2014: Created - - April 5th, 2014: Added to GitHub - - August 15th, 2014: Added Net Requests - - April 25th, 2019: Added Net Hooks, Global Vars, Client Vars, Persistence +--[[ ------------------------------------------------------------------------- +-- File name: +-- sv_netwrapper.lua +-- +-- Authors: +-- Mista-Tea ([IJWTB] Thomas) +-- xaviergmail (Xavier Bergeron) +-- +-- License: +-- The MIT License (copy/modify/distribute freely!) +-- +-- Changelog: +-- - March 9th, 2014: Created +-- - April 5th, 2014: Added to GitHub +-- - August 15th, 2014: Added Net Requests +-- - April 25th, 2019: Added Net Hooks, Global Vars, Client Vars, Persistence ----------------------------------------------------------------------------]] ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Namespace Tables --------------------------------------------------------------------------]]-- @@ -27,7 +27,7 @@ netwrapper.requests = netwrapper.requests or {} netwrapper.persistentvars = netwrapper.persistentvars or {} netwrapper.plypersistence = netwrapper.plypersistence or {} ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Localized Functions & Variables --------------------------------------------------------------------------]]-- @@ -44,15 +44,15 @@ util.AddNetworkString( "NetWrapperClear" ) local ENTITY = FindMetaTable( "Entity" ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- Namespace Functions --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- NET VARS --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Net - NetWrapperVar -- @@ -63,7 +63,7 @@ net.Receive( "NetWrapperVar", function( len, ply ) netwrapper.SyncClient( ply ) end ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.SyncClient( player ) -- @@ -95,7 +95,7 @@ function netwrapper.SyncClient( ply ) end end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.BroadcastNetVar( int, string, * ) -- @@ -111,7 +111,7 @@ function netwrapper.BroadcastNetVar( id, key, value ) net.Broadcast() end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.SendNetVar( player, int, string, *, boolean ) -- @@ -129,11 +129,11 @@ end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- NET REQUESTS --------------------------------------------------------------------------]]-- ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Net - NetWrapperRequest -- @@ -162,7 +162,7 @@ net.Receive( "NetWrapperRequest", function( bits, ply ) end end ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.SendNetRequest( player, number, string, * ) -- @@ -180,7 +180,7 @@ function netwrapper.SendNetRequest( ply, id, key, value ) end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.DefinePersistentVar( string ) -- @@ -197,7 +197,7 @@ function netwrapper.DefinePersistentVar( key ) netwrapper.persistentvars[ key ] = true end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.UndefinePersistentVar( string ) -- @@ -207,7 +207,7 @@ function netwrapper.UndefinePersistentVar( key ) netwrapper.persistentvars[ key ] = true end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- netwrapper.FilterPersistentVars( table ) -- @@ -227,7 +227,7 @@ function netwrapper.FilterPersistentVars( tbl ) return tbl end ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Hook - EntityRemoved( entity ) -- @@ -254,7 +254,7 @@ hook.Add( "EntityRemoved", "NetWrapperClear", function( ent ) netwrapper.ClearData( ent:NWIndex() ) end ) ---[[-------------------------------------------------------------------------- +--[[ ------------------------------------------------------------------------- -- -- Hook - EntityRemoved( entity ) -- diff --git a/lua/xlib/sh_traces.lua b/lua/xlib/sh_traces.lua index 941baf61c59920785b44d35d6a84864600208402..c99d8757791d5ecd92a34799ed8f24f30d1877b3 100644 --- a/lua/xlib/sh_traces.lua +++ b/lua/xlib/sh_traces.lua @@ -1,22 +1,22 @@ -- Credits: code_gs AKA github.com/Kefta -- https://github.com/Facepunch/garrysmod/pull/847/ ---[[--------------------------------------------------------- - Name: TraceEntityOBB - Params: <table tracedata> <ent entity> <bool quick> <bool verbose> - Returns: <table result> <table verboseresults> - Desc: Traces using an entity's bounding box offset along a line. - "Quick" parameter skips tracing through every corner and only traces between the start corner and end corner. - "Verbose" parameter returns every trace performed in a table - WARNING: This traces lines between an ent's bounding box corners. Small entities may "slip through". - TraceData structure: - Vector mins: Offset mins (lower back left corner). Optional. - Vector maxs: Offset maxs (upper front right corner). Optional. - Vector start: Traces from this position, if you /really/ want to. Optional. - Vector endpos: Traces from the entity's position (or the starting position) to this position. Optional. - Entity filter: Things the trace should not hit. Can also be a table of entities or a function with one argument. - boolean ignoreworld: Should the trace ignore world or not - table output: If set, the trace result will be written to the supplied table instead of returning a new table +--[[ -------------------------------------------------------- +-- Name: TraceEntityOBB +-- Params: <table tracedata> <ent entity> <bool quick> <bool verbose> +-- Returns: <table result> <table verboseresults> +-- Desc: Traces using an entity's bounding box offset along a line. +-- "Quick" parameter skips tracing through every corner and only traces between the start corner and end corner. +-- "Verbose" parameter returns every trace performed in a table +-- WARNING: This traces lines between an ent's bounding box corners. Small entities may "slip through". +-- TraceData structure: +-- Vector mins: Offset mins (lower back left corner). Optional. +-- Vector maxs: Offset maxs (upper front right corner). Optional. +-- Vector start: Traces from this position, if you /really/ want to. Optional. +-- Vector endpos: Traces from the entity's position (or the starting position) to this position. Optional. +-- Entity filter: Things the trace should not hit. Can also be a table of entities or a function with one argument. +-- boolean ignoreworld: Should the trace ignore world or not +-- table output: If set, the trace result will be written to the supplied table instead of returning a new table -----------------------------------------------------------]] function util.TraceEntityOBB(tracedata, ent, quick, verbose) local mins, maxs = ent:GetCollisionBounds() @@ -90,23 +90,23 @@ function util.TraceEntityOBB(tracedata, ent, quick, verbose) return tr end - --[[--------------------------------------------------------- - Name: TraceOBB - Params: <table tracedata> <bool quick> <bool verbose> - Returns: <table result> <table verboseresults> - Desc: Traces using a bounding box offset along a line. - "Quick" parameter skips tracing through every corner and only traces between the start corner and end corner. - "Verbose" parameter returns every trace performed in a table - WARNING: This traces lines between bounding box corners. Small entities may "slip through". - TraceData structure: - Vector mins: OBB mins (lower back left corner). - Vector maxs: OBB maxs (upper front right corner). - Angle angles: Angles of the OBB. - Vector start: The start position of the trace. - Vector endpos: The end position of the trace. - Entity filter: Things the trace should not hit. Can also be a table of entities or a function with one argument. - boolean ignoreworld: Should the trace ignore world or not - table output: If set, the trace result will be written to the supplied table instead of returning a new table +--[[ -------------------------------------------------------- +-- Name: TraceOBB +-- Params: <table tracedata> <bool quick> <bool verbose> +-- Returns: <table result> <table verboseresults> +-- Desc: Traces using a bounding box offset along a line. +-- "Quick" parameter skips tracing through every corner and only traces between the start corner and end corner. +-- "Verbose" parameter returns every trace performed in a table +-- WARNING: This traces lines between bounding box corners. Small entities may "slip through". +-- TraceData structure: +-- Vector mins: OBB mins (lower back left corner). +-- Vector maxs: OBB maxs (upper front right corner). +-- Angle angles: Angles of the OBB. +-- Vector start: The start position of the trace. +-- Vector endpos: The end position of the trace. +-- Entity filter: Things the trace should not hit. Can also be a table of entities or a function with one argument. +-- boolean ignoreworld: Should the trace ignore world or not +-- table output: If set, the trace result will be written to the supplied table instead of returning a new table -----------------------------------------------------------]] function util.TraceOBB(tracedata, quick, verbose) local mins, maxs = tracedata.mins, tracedata.maxs diff --git a/lua/xlib/sh_util.lua b/lua/xlib/sh_util.lua index fb19b8d0cc8f51d0f072508b6ffa4da51e8c5fb5..d363a86727028f5e8f4f56bbaec5f39315c4b96d 100644 --- a/lua/xlib/sh_util.lua +++ b/lua/xlib/sh_util.lua @@ -1,3 +1,31 @@ +--- @module xlib.utils +-- +-- A set of useful utility functions that don't fit into a category of their own. + +-- https://en.wikipedia.org/wiki/Double-precision_floating-point_format +local double_min = = -(2^-53) +local double_max = (2^53)-1 + +--- Integer-safe tonumber +-- +-- This function will return nil if the number to be converted +-- exceeds the integer-definable range of IEEE 754 doubles +-- @tparam string str String to be converted to number +-- @treturn[1] number The converted number, if the conversion is safe +-- @treturn[2] nil Nil if the conversion would lose integer precision +function XLIB.tonumber(str) + local num = tonumber(str) + if not num then return nil end + + if num < double_min or num > double_max then return nil end + return num +end + +--- Freezes an entity in place +-- +-- This sets the entity's movetype to `MOVETYPE_NONE` and disables +-- motion on its physics object in order to avoid clientside prediction errors. +-- @tparam Entity ent Entity to freeze function XLIB.FreezeProp(ent) ent:SetMoveType(MOVETYPE_NONE) local phys = ent:GetPhysicsObject() @@ -13,6 +41,12 @@ local rmask = bit.lshift(0xFF, rshift) local gmask = bit.lshift(0xFF, gshift) local bmask = bit.lshift(0xFF, bshift) +--- Serializes a Color object into an integer +-- +-- This is a useful way to store a Color object in binary format +-- as it only uses one double, opposed to 4 (Or god forbid a String) +-- @tparam Color color Color to convert to an int +-- @treturn number The color object represented as an integer function XLIB.ColorToInt(color) return bit.bor( bit.lshift(color.a, ashift), @@ -22,6 +56,11 @@ function XLIB.ColorToInt(color) ) end +--- Deserializes an integer into a Color object +-- +-- @see XLIB.ColorToInt +-- @tparam number int Integer to convert to a Color object +-- @treturn Color function XLIB.IntToColor(int) local a, r, g, b = bit.rshift(bit.band(int, amask), ashift), @@ -32,6 +71,12 @@ function XLIB.IntToColor(int) return Color(r, g, b, a) end +--- Clamps all values of a color object between 0-255 +-- +-- @warn This modifies the color object passed to it rather than creating a copy! +-- @tparam Color color The color object to clamp +-- @tparam bool[opt=false] noalpha Forces the alpha channel to 255 if true +-- @treturn Color The color object passed as the first argument function XLIB.SafeColor(color, noalpha) color.r = math.Clamp(color.r, 0, 255) color.g = math.Clamp(color.g, 0, 255) @@ -40,6 +85,12 @@ function XLIB.SafeColor(color, noalpha) return color end +--- Shortcut for XLIB.SafeColor(..., true) +-- +-- Clamps all the values of a color object between 0-255 and forces the alpha to 255 +-- @warn This modifies the color object passed to it rather than creating a copy! +-- @tparam Color color The color object to clamp +-- @see XLIB.SafeColor function XLIB.SafeColorNoAlpha(color) return XLIB.SafeColor(color, true) end diff --git a/lua/xlib/thirdparty/sh_lpeg.lua b/lua/xlib/thirdparty/sh_lpeg.lua index 6924237088e153f31295a6d476c15d9f8f36ac31..c1fdd802ef56ac6a828790b7bbb5a4c3bf5a4d92 100644 --- a/lua/xlib/thirdparty/sh_lpeg.lua +++ b/lua/xlib/thirdparty/sh_lpeg.lua @@ -1,14 +1,15 @@ --- LuLPeg, a pure Lua port of LPeg, Roberto Ierusalimschy's --- Parsing Expression Grammars library. +--- +-- LuLPeg, a pure Lua port of LPeg, Roberto Ierusalimschy's Parsing Expression Grammars library. +-- +-- See [http://www.inf.puc-rio.br/~roberto/lpeg/](http://www.inf.puc-rio.br/~roberto/lpeg/) for the original documentation -- -- Copyright (C) Pierre-Yves Gerardy. -- Released under the Romantic WTF Public License (cf. the LICENSE -- file or the end of this file, whichever is present). -- --- See http://www.inf.puc-rio.br/~roberto/lpeg/ for the original. --- --- The re.lua module and the test suite (tests/lpeg.*.*.tests.lua) --- are part of the original LPeg distribution. +-- @module lpeg + + local _ENV, loaded, packages, release, require_ = _ENV or _G, {}, {}, true, require diff --git a/lua/xlib_extended/sh_delayhttp.lua b/lua/xlib_extended/sh_httpdelay.lua similarity index 100% rename from lua/xlib_extended/sh_delayhttp.lua rename to lua/xlib_extended/sh_httpdelay.lua