{"id":23,"date":"2006-04-15T10:21:41","date_gmt":"2006-04-15T10:21:41","guid":{"rendered":"https:\/\/astrofra.com\/wordpress\/?p=23"},"modified":"2006-04-15T10:21:41","modified_gmt":"2006-04-15T10:21:41","slug":"lua-experiment-2","status":"publish","type":"post","link":"https:\/\/astrofra.com\/wordpress\/index.php\/2006\/04\/15\/lua-experiment-2\/","title":{"rendered":"Lua experiment"},"content":{"rendered":"<p>For some reasons, I had the opportunity to test the <a hreflang=\"en\" href=\"http:\/\/www.lua.org\/\" target=\"_blank\">LUA<\/a> language. I spent one evening on it, then switched to Squirrel (which is very close). What I appreciate the most with scripted languages is that the classic C++ turnaround loop (Stop &#8212; Debug &#8212; Compile &#8212; Link &#8212; Start) is made a lot easier.<\/p>\n<p>I took a moment to see how <a hreflang=\"en\" href=\"http:\/\/www.lua.org\/manual\/5.1\/manual.html#2\">basic scripting<\/a> turns out in LUA, then practicing things like <strong>tables, list, sort, file IO<\/strong>, it ended up in this :<\/p>\n<table>\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"\/weblog\/images\/Tuts\/lua_mandel.jpg\" alt=\"\" \/><\/td>\n<td><a hreflang=\"en\" href=\"https:\/\/astrofra.com\/weblog\/files\/linked_list.lua\">Table \/ Linked list test<\/a> : put  values in a table, then in a list, display them.<\/p>\n<p><a hreflang=\"en\" href=\"https:\/\/astrofra.com\/weblog\/files\/sort.lua\">Sort table of values<\/a> : put randomized values in a table, sort it, and display it.<\/p>\n<p><a hreflang=\"en\" href=\"https:\/\/astrofra.com\/weblog\/files\/gradient.lua\">Bitmap output<\/a> : throw <strong>RGB pixels in a binary file<\/strong>. This creates a <strong>RAW<\/strong> file, that you can <strong>open in Photoshop<\/strong> as long as you know its size &amp; depth. The purpose of this was to be able to render a Mandelbrot figure to a file.<\/p>\n<p><a hreflang=\"en\" href=\"https:\/\/astrofra.com\/weblog\/files\/mandelbrot.lua\">Mandelbrot fractal<\/a> : using the previous routine, this sample simply computes the famous Mandelbrot figure. Left is the result.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>For some reasons, I had the opportunity to test the LUA language. I spent one evening on it, then switched to Squirrel (which is very close). What I appreciate the most with scripted languages is that the classic C++ turnaround loop (Stop &#8212; Debug &#8212; Compile &#8212; Link &#8212; Start) is made a lot easier. &hellip; <a href=\"https:\/\/astrofra.com\/wordpress\/index.php\/2006\/04\/15\/lua-experiment-2\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Lua experiment<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,1],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-prog","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/23"}],"collection":[{"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":0,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"wp:attachment":[{"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/astrofra.com\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}