CINXE.COM
Sam Trenholme's Blog
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><title>Sam Trenholme's Blog</title> <style> body { background-color: #fff; color: #333; } .rside { display: none; } </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta property="fb:admins" content="sam.trenholme"/> <link rel="stylesheet" type="text/css" href="../samiam_2019p.css" media="only screen and (max-width: 640px)" /> <link rel="stylesheet" type="text/css" media="only screen and (min-width: 641px)" title="Blue Sky (default)" href="../samiam_2020c.css" /> <link rel="alternate" type="application/rss+xml" title="Sam Trenholme RSS Feed" href="https://www.samiam.org/blog/blog.rss" /> <script> var vh = ('a2 = window.loc' + 'ation.href.indexOf("via.hypothes.is/");' + 'if (a2 !== -1) {' + 'loca' + 'tion.href = window.location.href.replace("via.hypothes.is/", "")}'); eval(vh); </script> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" > <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="../samiam_b5.css" media="all" /> <link rel="stylesheet" type="text/css" href="../samiam_b5_ie8.css" media="all" /> <![endif]--> <link rel="stylesheet" type="text/css" media="print" href="../samiam_2017p.css"> <link rel="stylesheet" type="text/css" media="handheld" href="../samiam_h.css"> <!--[if IE]> <style type="text/css"> .lbox { width: 7.42em; } .ie7bug { font-size: 0; } .body { font-size: medium; } .wqbody { font-size: medium; } .wtbody { font-size: medium; } </style> <![endif]--> </head> <body bgcolor="#cae6c7" text="#000000" link="#3b5e35" vlink="#3b5e35"> <div class=stable style="direction: rtl"> <div class=rside style="direction: ltr"> <div class=m1> <div class=m2> <div class=m3> <div class=m4> <div class=m5> <div class=m6> <div class=m7> <div class=m8b> <iframe frameborder=0 width=160 height=600 scrolling=no src=/blog/iframe.html></iframe> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div class=lside style="direction: ltr"> <div class=wall> <div class=whead> <div class=wimage><img src=../Webpage-text-7.png width=480 height=109></div> <div class=wtext>Sam Trenholme's webpage</div> </div> <div class=wlinks> <a href="http://www.samiam.org/index.html">Main</a> <span class=n>-</span> <a href="/resume">Résumé</a> <span class=n>-</span> <a href="http://www.samiam.org/blog/">Blog</a> <span class=n>-</span> <A href="../links.html">Site Map</A> <span class=n>-</span> <A href="../software.html">Software</A> </div> </div> <div class=m1l> <div class=m2> <div class=m3> <div class=m4> <div class=m5> <div class=m6> <div class=m7> <div class=m8> <i class=support><div style="float: right"><A href=idx.html>Go to blog index</A></div><a href="https://www.paypal.me/caulixtla" >Support this website</a> <!--span class=n>-</span> <a href="http://caulixtla.com/music/" >listen to my music</a --></i><br> <div class=blogpiclx style="text-align: right"> <img src=pics/2024-05-01.jpg width=224 height=126> </div> <div class=bloghead><h1 class=hh3r>Free ebook</h1> <div class=blogtaglistr><div class=support> <A href=2023-02-28.html> Previous entry</A> <span class=n>-</span> Next entry <span class=n>-</span> <A href=/blog/idx.html>Blog index</A></div></div><div class=blogtitlem style="display: inherit;margin-top: 0.5em"> </div><h2 class=h2month>May 15 2024</h2></div> I have spent a month writing a free open content (public domain) e-book about programming in Lua. While Lua’s terse reference manual is open content, the official book for programming in Lua is proprietary. I wrote this book as a guide to programming in Lua that is open content, and that is geared towards Lua 5.1, the most commonly deployed version of Lua out there. <p> The book is not an introduction to programming; in particular, it assumes the reader is already familiar with other scripting languages such as AWK, Perl, or Python. The book concentrates more on the parts of Lua which can be difficult for people used to other scripting languages to understand, such as function closures, how Lua uses function factories to run for loops (and how one can have Lua iterate through items in a list using the right function in a for loop), metatables, and Lua’s prototypical class model. <p> This book uses a large number of code examples to illustrate how code is written in Lua, and to provide public domain “battery” code (such as a regular expression splitter and a function which makes regular expressions case insensitive) people can use in their own Lua scripts. <p> This book is not a Lua reference; a very terse reference manual is already included with Lua. This is a companion to the reference manual to have code examples and longer explanations of the concepts expressed in that manual. <p> The book can be read here: <p> <blockquote> <A href="https://maradns.samiam.org/lunacy/SamDiscussesLunacy.pdf">https://<![if gt IE 6]>​<![endif]><wbr>maradns.<![if gt IE 6]>​<![endif]><wbr>samiam.<![if gt IE 6]>​<![endif]><wbr>org/<![if gt IE 6]>​<![endif]><wbr>lunacy/<![if gt IE 6]>​<![endif]><wbr>Sam<![if gt IE 6]>​<![endif]><wbr>Discusses<![if gt IE 6]>​<![endif]><wbr>Lunacy.<![if gt IE 6]>​<![endif]><wbr>pdf</A> </blockquote> In addition to the PDF e-book, the Open Document source, as well as all fonts used in the book, is also available as part of my “Lunacy” fork of Lua 5.1: <p> <blockquote> <A href="https://github.com/samboy/lunacy">https://github.com/samboy/lunacy</A> </blockquote> Look in the <tt>doc/</tt> folder. <p> <i>Comments for blog entries can be seen in the <a href=https://github.com/samboy/MaraDNS/discussions/93>forum</a>. </i> <p> <div class=support> <A href=2023-02-28.html> Previous entry</A> <span class=n>-</span> Next entry <span class=n>-</span> <A href=/blog/idx.html>Blog index</A></div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <script src="/gb.js"></script> </body></html>