[syslinux:master] lua: docs: remove overall indentation and some verbose cruft from the examples

syslinux-bot for Ferenc Wágner wferi at niif.hu
Sat Feb 14 11:09:14 PST 2015


Commit-ID:  ca010f436d431edc8f4bd4a17819d5fe6c6c9570
Gitweb:     http://www.syslinux.org/commit/ca010f436d431edc8f4bd4a17819d5fe6c6c9570
Author:     Ferenc Wágner <wferi at niif.hu>
AuthorDate: Thu, 3 Jul 2014 18:06:54 +0200
Committer:  Ferenc Wágner <wferi at niif.hu>
CommitDate: Sat, 11 Oct 2014 21:59:15 +0200

lua: docs: remove overall indentation and some verbose cruft from the examples

Signed-off-by: Ferenc Wágner <wferi at niif.hu>

---
 com32/lua/doc/syslinux.asc | 203 ++++++++++++++++++++++-----------------------
 1 file changed, 99 insertions(+), 104 deletions(-)

diff --git a/com32/lua/doc/syslinux.asc b/com32/lua/doc/syslinux.asc
index 6b53024..6da9b79 100644
--- a/com32/lua/doc/syslinux.asc
+++ b/com32/lua/doc/syslinux.asc
@@ -53,8 +53,8 @@ Execute syslinux command line +command+.
 
 _Example_:
 ......................................................
-	local sl = require "syslinux"
-	sl.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
+local sl = require "syslinux"
+sl.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
 ......................................................
 
 .run_default()
@@ -111,25 +111,25 @@ initialized, +file+ has been loaded by loadfile().
 
 _Example_:
 ......................................................
-	local sl = require "syslinux"
-	
-	-- get nice output
-	printf = function(s,...)
-	           return io.write(s:format(...))
-	         end -- function
-	
-	kernel = sl.loadfile("/SuSE-11.1/x86_64/linux")
-	
-	printf("Filename/size: %s %d\n", sl.filename(kernel), sl.filesize(kernel))
-	
-	initrd = sl.loadfile("/SuSE-11.1/x86_64/initrd")
-	
-	printf("Filename/size: %s %d\n", sl.filename(initrd), sl.filesize(initrd))
-	
-	initrd = sl.initramfs_init()
-	sl.initramfs_load_archive(initrd, "/SuSE-11.1/x86_64/initrd");
-	
-	sl.boot_it(kernel, initrd, "init=/bin/bash")
+local sl = require "syslinux"
+
+-- get nice output
+printf = function(s,...)
+           return io.write(s:format(...))
+         end -- function
+
+kernel = sl.loadfile("/SuSE-11.1/x86_64/linux")
+
+printf("Filename/size: %s %d\n", sl.filename(kernel), sl.filesize(kernel))
+
+initrd = sl.loadfile("/SuSE-11.1/x86_64/initrd")
+
+printf("Filename/size: %s %d\n", sl.filename(initrd), sl.filesize(initrd))
+
+initrd = sl.initramfs_init()
+sl.initramfs_load_archive(initrd, "/SuSE-11.1/x86_64/initrd");
+
+sl.boot_it(kernel, initrd, "init=/bin/bash")
 ......................................................
 
 .KEY
@@ -157,35 +157,35 @@ Returns +true+ if DMI is supported on machine, +false+ otherwise.
 
 .gettable()
 
-Returns a list if key-value pairs. The key is one of the DMI property strings:
+Returns a list of key-value pairs. The key is one of the DMI property strings:
 FIXME list
 
 _Example_:
 ......................................................
-	local sl = require "syslinux"
-	local dmi = require "dmi"
-
-	if (dmi.supported()) then
-	
-	  dmitable = dmi.gettable()
-	
-	  for k,v in pairs(dmitable) do
-	    print(k, v)
-	  end
-	
-	  print(dmitable.system.manufacturer)
-	  print(dmitable.system.product_name)
-	  print(dmitable.bios.bios_revision)
-	
-	  if ( string.match(dmitable.system.product_name, "ESPRIMO P7935") ) then
-	    print("Matches")
-	    sl.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
-	  else
-	    print("Does not match")
-	    sl.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
-	  end
-	
-	end
+local sl = require "syslinux"
+local dmi = require "dmi"
+
+if (dmi.supported()) then
+
+  dmitable = dmi.gettable()
+
+  for k,v in pairs(dmitable) do
+    print(k, v)
+  end
+
+  print(dmitable.system.manufacturer)
+  print(dmitable.system.product_name)
+  print(dmitable.bios.bios_revision)
+
+  if ( string.match(dmitable.system.product_name, "ESPRIMO P7935") ) then
+    print("Matches")
+    sl.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
+  else
+    print("Does not match")
+    sl.run_command("memdisk initrd=/dos/BIOS/FSC-P7935-108.img raw")
+  end
+
+end
 ......................................................
 
 
@@ -221,10 +221,10 @@ pciids = pci.getidlist("/pci.ids")
 for dind,device in pairs(pciinfo) do
 
   -- search for device description
-  search = string.format("%04x%04x", device['vendor'], device['product'])
+  search = string.format("%04x%04x", device.vendor, device.product)
 
-  printf(" %04x:%04x:%04x:%04x = ", device['vendor'], device['product'],
-			device['sub_vendor'], device['sub_product'])
+  printf(" %04x:%04x:%04x:%04x = ", device.vendor, device.product,
+			device.sub_vendor, device.sub_product)
 
   if ( pciids[search] ) then
          printf("%s\n", pciids[search])
@@ -250,20 +250,17 @@ Return list of available VESA modes.
 
 _Example_:
 ......................................................
-	local vesa = require "vesa"
-	
-	-- get nice output
-	printf = function(s,...)
-	           return io.write(s:format(...))
-	         end
-	
-	-- list available vesa modes
-	-- only one supported right now, not of much use
-	modes = vesa.getmodes()
-	
-	for mind,mode in pairs(modes) do
-	   printf("%04x: %dx%dx%d\n", mode['mode'], mode['hres'], mode['vres'], mode['bpp'])
-	end
+local vesa = require "vesa"
+
+-- get nice output
+printf = function(s,...)
+           return io.write(s:format(...))
+         end
+
+-- list available vesa modes
+for mind,mode in pairs(vesa.getmodes()) do
+   printf("%04x: %dx%dx%d\n", mode.mode, mode.hres, mode.vres, mode.bpp)
+end
 ......................................................
 
 
@@ -277,46 +274,44 @@ Load +filename+ from TFTP, and use it as background image.
 
 _Example_:
 ......................................................
-	local sl = require "syslinux"
-	local vesa = require "vesa"
-	
-	-- get nice output
-	printf = function(s,...)
-	           return io.write(s:format(...))
-	         end
-	
-	-- lets go to graphics land
-	vesa.setmode()
-	
-	printf("Hello World! - VESA mode")
-	
-	-- some text to display "typing style"
-	textline=[[
-	From syslinux GSOC 2009 home page:
-	
-	Finish the Lua engine
-	
-	We already have a Lua interpreter integrated with the Syslinux build. However, right now it is not very useful. We need to create a set of bindings to the Syslinux functionality, and have an array of documentation and examples so users can use them.
-	
-	This is not a documentation project, but the documentation deliverable will be particularly important for this one, since the intended target is system administrators, not developers.
-	]]
-	
-	
-	-- do display loop
-	-- keep in mind: background change will not erase text!
-	while ( true ) do
-	
-	vesa.load_background("/background1.jpg")
-	
-	sl.sleep(1)
-	
-	for i = 1, #textline do
-	    local c = textline:sub(i,i)
-	    printf("%s", c)
-	    sl.msleep(200)
-	end
-	
-	sl.sleep(10)
+local sl = require "syslinux"
+local vesa = require "vesa"
 
-......................................................
+-- get nice output
+printf = function(s,...)
+           return io.write(s:format(...))
+         end
+
+-- lets go to graphics land
+vesa.setmode()
 
+printf("Hello World! - VESA mode")
+
+-- some text to display "typing style"
+textline=[[
+From syslinux GSOC 2009 home page:
+
+Finish the Lua engine
+
+We already have a Lua interpreter integrated with the Syslinux build. However, right now it is not very useful. We need to create a set of bindings to the Syslinux functionality, and have an array of documentation and examples so users can use them.
+
+This is not a documentation project, but the documentation deliverable will be particularly important for this one, since the intended target is system administrators, not developers.
+]]
+
+
+-- do display loop
+-- keep in mind: background change will not erase text!
+while ( true ) do
+
+vesa.load_background("/background1.jpg")
+
+sl.sleep(1)
+
+for i = 1, #textline do
+    local c = textline:sub(i,i)
+    printf("%s", c)
+    sl.msleep(200)
+end
+
+sl.sleep(10)
+......................................................


More information about the Syslinux-commits mailing list