grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] LUA script engine for grub2


From: Bean
Subject: [PATCH] LUA script engine for grub2
Date: Tue, 7 Apr 2009 22:31:44 +0800

Hi,

This patch integrate the LUA script engine to grub2. Before applying
this patch, you should apply the split module patch split_3.diff
first.

BTW, I forget to add Makefile.in the previous split_3.diff, so that
handler.lst will not be generated, I include it in this one.

To try the LUA engine, you can enter command line, and use:

parser.lua

Inside lua, you can use grub.run to execute grub commands, such as:

grub.run("ls", "-l")

To switch back to sh, you can run this command:

grub.run("parser.sh")

Here is a small lua program to solve the hanoi tower:

function hanoi(n,a,b,c)
if (n == 1) then
  print ("move from", a, "to", c)
else
  hanoi (n-1, a, c, b)
  hanoi (1, a, b, c)
  hanoi (n-1, b, a, c)
end
end
hanoi (3, 1, 2, 3)



-- 
Bean

Attachment: lua.zip
Description: Zip archive


reply via email to

[Prev in Thread] Current Thread [Next in Thread]