\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{harold} \pdfinfo{ /Title (lua-api.pdf) /Creator (Cheatography) /Author (harold) /Subject (Lua API Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Lua API Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{harold} via \textcolor{DarkBackground}{\uline{cheatography.com/147233/cs/32006/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}harold \\ \uline{cheatography.com/harold} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 5th May, 2022.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Built-in}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{assert (v {[}, message{]})}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{getmetatable (object) -\textgreater{} table}}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ipairs (t) -\textgreater{} func, t, 0}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{load (chunk {[}, chunkname {[}, mode {[}, env{]}{]}{]}) -\textgreater{} func | nil, err\_msg}}} \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{loadfile ({[}filename {[}, mode {[}, env{]}{]}{]}) -\textgreater{} func | nil, err\_msg}}} \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{next (table {[}, index{]}) -\textgreater{} value, next\_i}}} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{pairs (t) -\textgreater{} v1, v2, v3 | next, t, nil}}} \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{rawget (table, index) -\textgreater{} val}}} \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{rawset (table, index, value)}}} \tn % Row Count 11 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{`select (index, ···) -\textgreater{} {[}i...{]}`}}} \tn % Row Count 12 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{setmetatable (table, metatable) -\textgreater{} table}}} \tn % Row Count 13 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{type (v) -\textgreater{} t\_str}}} \tn % Row Count 14 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{pcall (f {[}, arg1, ···{]}) -\textgreater{} true, val | false}}} \tn % Row Count 16 (+ 2) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{xpcall (f, msgh {[}, arg1, ···{]}) -\textgreater{} true, val | false}}} \tn % Row Count 18 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{table}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{table.concat (list {[}, sep {[}, i {[}, j{]}{]}{]}) -\textgreater{} str}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ table.insert (list, {[}pos,{]} value) }}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ table.move (a1, f, e, t {[},a2{]}) }}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ table.remove (list {[}, pos{]}) }}} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ table.unpack (list {[}, i {[}, j{]}{]}) -\textgreater{} ... }}} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ table.pack (···) -\textgreater{} table }}} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ table.sort (list {[}, comp{]}) }}} \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{corutine}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ coroutine.create (closure\_gen\_func) -\textgreater{} thread }}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ coroutine.wrap (func) -\textgreater{} thread }}} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ coroutine.resume (co {[}, val1, ···{]}) -\textgreater{} true, val1, ... | false, err }}} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ coroutine.yield (···) }}} \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ coroutine.isyieldable () -\textgreater{} bool}}} \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ coroutine.running () -\textgreater{} bool }}} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ coroutine.status (co) -\textgreater{} "running" | "suspended" | "normal" | "dead" }}} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{os}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.clock () -\textgreater{} timeval }}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.time ({[}table{]}) -\textgreater{} timeval }}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.date ({[}format {[}, time{]}{]}) -\textgreater{} time\_str }}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.setlocale (locale {[}, category{]}) -\textgreater{} name | nil }}} \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.difftime (t2, t1) -\textgreater{} t2-t1 }}} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.execute ({[}command{]}) -\textgreater{} true, "exit" | nil, "signal", signo }}} \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.exit ({[}code {[}, close{]}{]}) }}} \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.getenv (varname) -\textgreater{} env\_arg | nil }}} \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.remove (filename) -\textgreater{} true | nil, err, err\_code }}} \tn % Row Count 12 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ os.rename (oldname, newname) -\textgreater{} true | nil, err, err\_code }}} \tn % Row Count 14 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{` os.tmpname () -\textgreater{} temp\_name `}}} \tn % Row Count 15 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Command Line}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ lua -e \textless{}statements\textgreater{} }} \newline % Row Count 1 (+ 1) {\bf{arg}} is a table contain command line arguments% Row Count 2 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{string}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.match (s, pattern {[}, init{]}) -\textgreater{} cap1, cap2, ... | nil}}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.gmatch (s, pattern) -\textgreater{} match\_iter\_func | nil}}} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.sub (s, i {[}, j{]}) -\textgreater{} sub\_str}}} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.gsub (s, pattern, repl {[}, n{]}) -\textgreater{} sub\_str}}} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.find (s, pattern {[}, init {[}, plain{]}{]}) -\textgreater{} start, end | nil}}} \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.byte (s {[}, i {[}, j{]}{]}) -\textgreater{} byte1, ...}}} \tn % Row Count 10 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.char (···) -\textgreater{} str}}} \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.dump (function {[}, strip{]}) -\textgreater{} func\_str}}} \tn % Row Count 12 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.pack (fmt, v1, v2, ···) -\textgreater{} bin\_str}}} \tn % Row Count 13 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{`string.packsize (fmt) -\textgreater{} str\_len`}}} \tn % Row Count 14 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{`string.rep (s, n {[}, sep{]}) -\textgreater{} n\_s`}}} \tn % Row Count 15 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{`string.reverse (s) -\textgreater{} r\_s`}}} \tn % Row Count 16 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{`string.lower (s) -\textgreater{} l\_s`}}} \tn % Row Count 17 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{`string.upper (s) -\textgreater{} u\_s`}}} \tn % Row Count 18 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{string.format (formatstring, ···) -\textgreater{} f\_str}}} \tn % Row Count 19 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{gmatch: match\_iter\_func() -\textgreater{} cap1, cap2, ...}} \newline {\bf{gsub: repl}} \newline table: use capture as key, retrive \newline function: use captures as parameters \newline str\_pattern: use \%n as captures, \%0 is whole} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{io}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.open (filename {[}, mode{]}) -\textgreater{} File }}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.close ({[}file{]}) }}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.flush () }}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.input ({[}file{]}) -\textgreater{} in\_File}}} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.output ({[}file{]}) -\textgreater{} out\_File }}} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.lines ({[}filename ···{]}) -\textgreater{} iter\_line\_func }}} \tn % Row Count 7 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.popen (prog {[}, mode{]}) -\textgreater{} File }}} \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.read (···) }}} \tn % Row Count 9 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.write (···) }}} \tn % Row Count 10 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.tmpfile () -\textgreater{} tmp\_File }}} \tn % Row Count 11 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ io.type (File) -\textgreater{} "file" | "close\_file" | nil }}} \tn % Row Count 13 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ file:close () }}} \tn % Row Count 14 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ file:flush () }}} \tn % Row Count 15 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ file:lines (···) -\textgreater{} iter\_line\_func }}} \tn % Row Count 16 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ file:read (···) }}} \tn % Row Count 17 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ file:seek ({[}whence {[}, offset{]}{]}) }}} \tn % Row Count 18 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ file:setvbuf (mode {[}, size{]}) }}} \tn % Row Count 19 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ file:write (···) -\textgreater{} file | nil, err }}} \tn % Row Count 20 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{math}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.abs (x) }}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.acos (x) }}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.asin (x) }}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.atan (y {[}, x{]}) }}} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.ceil (x) }}} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.cos (x) }}} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.deg (x) }}} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.exp (x) }}} \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.floor (x) }}} \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.fmod (x, y) -\textgreater{} (integer/float) }}} \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.log (x {[}, base{]}) }}} \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.max (x, ···) }}} \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.min (x, ···) }}} \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.modf (x) -\textgreater{} int\_part, frac\_part }}} \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.rad (x) }}} \tn % Row Count 15 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.random ({[}m {[}, n{]}{]}) }}} \tn % Row Count 16 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.randomseed (x) }}} \tn % Row Count 17 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.sin (x) }}} \tn % Row Count 18 (+ 1) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.sqrt (x) }}} \tn % Row Count 19 (+ 1) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.tan (x) }}} \tn % Row Count 20 (+ 1) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.tointeger (x) }}} \tn % Row Count 21 (+ 1) % Row 21 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.type (x) -\textgreater{} "integer" | "float" | nil }}} \tn % Row Count 22 (+ 1) % Row 22 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ math.ult (m, n) -{}- unsigned less }}} \tn % Row Count 23 (+ 1) % Row 23 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{` math.huge `}}} \tn % Row Count 24 (+ 1) % Row 24 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{` math.maxinteger `}}} \tn % Row Count 25 (+ 1) % Row 25 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{` math.mininteger `}}} \tn % Row Count 26 (+ 1) % Row 26 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{` math.pi `}}} \tn % Row Count 27 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{字符类}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{x: (这里 x 不能是 魔法字符 \textasciicircum{}\$()\%.{[}{]}*+-? 中的一员) 表示字符 x 自身。 \newline % Row Count 2 (+ 2) .: \seqsplit{(一个点)可表示任何字符。} \newline % Row Count 3 (+ 1) \%a: 表示任何字母。 \newline % Row Count 4 (+ 1) \%c: \seqsplit{表示任何控制字符。} \newline % Row Count 5 (+ 1) \%d: 表示任何数字。 \newline % Row Count 6 (+ 1) \%g: \seqsplit{表示任何除空白符外的可打印字符。} \newline % Row Count 8 (+ 2) \%l: \seqsplit{表示所有小写字母。} \newline % Row Count 9 (+ 1) \%p: \seqsplit{表示所有标点符号。} \newline % Row Count 10 (+ 1) \%s: \seqsplit{表示所有空白字符。} \newline % Row Count 11 (+ 1) \%u: \seqsplit{表示所有大写字母。} \newline % Row Count 12 (+ 1) \%w: \seqsplit{表示所有字母及数字。} \newline % Row Count 13 (+ 1) \%x: 表示所有 16 进制数字符号。 \newline % Row Count 14 (+ 1) \%x: (这里的 x \seqsplit{是任意非字母或数字的字符)} 表示字符 x。 \newline % Row Count 16 (+ 2) {[}set{]}: 表示 \seqsplit{set 中所有字符的联合。} 可以以 '-' \seqsplit{连接,升序书写范围两端的字符来表示一个范围的字符集。} \newline % Row Count 19 (+ 3) {[}\textasciicircum{}set{]}: 表示 set 的补集。% Row Count 20 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{模式条目}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\seqsplit{单个字符类匹配该类别中任意单个字符;} \newline % Row Count 2 (+ 2) 单个字符类跟一个 '*', \seqsplit{将匹配零或多个该类的字符。} \seqsplit{这个条目总是匹配尽可能长的串;} \newline % Row Count 5 (+ 3) 单个字符类跟一个 '+', \seqsplit{将匹配一或更多个该类的字符。} \seqsplit{这个条目总是匹配尽可能长的串;} \newline % Row Count 8 (+ 3) 单个字符类跟一个 '-', \seqsplit{将匹配零或更多个该类的字符。} 和 '*' 不同, \seqsplit{这个条目总是匹配尽可能短的串;} \newline % Row Count 11 (+ 3) 单个字符类跟一个 '?', \seqsplit{将匹配零或一个该类的字符。} \seqsplit{只要有可能,它会匹配一个;} \newline % Row Count 14 (+ 3) \%n, 这里的 n 可以从 1 到 9; \seqsplit{这个条目匹配一个等于} n \seqsplit{号捕获物(后面有描述)的子串。} \newline % Row Count 17 (+ 3) \%bxy, 这里的 x 和 y \seqsplit{是两个明确的字符;} 这个条目匹配以 x 开始 y 结束 \newline % Row Count 19 (+ 2) \%f{[}set{]}, 指 边境模式; \seqsplit{这个条目会匹配到一个位于} set \seqsplit{内某个字符之前的一个空串,} \seqsplit{且这个位置的前一个字符不属于} set 。% Row Count 23 (+ 4) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} p{0.4977 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{模式与捕获}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\seqsplit{模式:指一个模式条目的序列。如果} '\textasciicircum{}' 和 '\$' \seqsplit{出现在其它位置,它们均没有特殊含义,只表示自身。} \newline 捕获:模式可以在内部用小括号括起一个子模式; 这些子模式被称为 捕获物。} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{debug}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.debug () }}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.gethook ({[}thread{]}) -\textgreater{} hk\_func, hk\_mask, hk\_cnt }}} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.getinfo ({[}thread,{]} f {[}, what{]}) }}} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.getlocal ({[}thread,{]} f, local) -\textgreater{} name, val }}} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.getmetatable (value) -\textgreater{} mt }}} \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.getregistry () -\textgreater{} registry\_table }}} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.getupvalue (f, up) -\textgreater{} up\_name, up\_val }}} \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.getuservalue (u) -\textgreater{} usr\_val | nil }}} \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.sethook ({[}thread,{]} hook, mask {[}, count{]}) }}} \tn % Row Count 12 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.setlocal ({[}thread,{]} level, local, value) -\textgreater{} local\_name | nil }}} \tn % Row Count 14 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.setmetatable (value, table) }}} \tn % Row Count 15 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.setupvalue (f, up, value) -\textgreater{} up\_name | nil }}} \tn % Row Count 17 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.setuservalue (udata, value) -\textgreater{} udata }}} \tn % Row Count 18 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.traceback ({[}thread,{]} {[}message {[}, level{]}{]}) }}} \tn % Row Count 20 (+ 2) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.upvalueid (f, n) }}} \tn % Row Count 21 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{ debug.upvaluejoin (f1, n1, f2, n2) }}} \tn % Row Count 22 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}