grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] LUA script engine for grub2


From: Bean
Subject: Re: [PATCH] LUA script engine for grub2
Date: Wed, 8 Apr 2009 02:27:07 +0800

2009/4/8 Vesa Jääskeläinen <address@hidden>:
> Bean wrote:
>> 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")
>
> I would prefer something like grub.return or grub.exit, or something
> like that if really needed.

Hi,

I add a grub library to lua, now it only contain grub.run, but it
would be easy to add more function. I think it would be useful to add
function to interface with the video subsystem directly, so that lua
can be used to control the dynamic drawing of ui components.

> Here is something that I would like that it can do:
>
> In GUI definition:
>
> action="lua:grub.run(\"ls\", \"-l\")" and action="my_lua_action.lua"
>
> or just
>
> action="lua:my_lua_action.lua"
>
> and
>
> action="ls -l" or action="(ba)sh:ls -l"
>
> This way one could use both grub bash scripting and lua scripting.
>
> Now if something is being executed in my_lua_action.lua and execution
> comes to the end it should return to calling code.
>
> grub_lua_execute_file("<file name to lua script>");
> grub_lua_execute("<lua commands>");

In fact, I have extended the configfile command to accept parser parameter:

configfile /new_script.lua lua

or

source /script.lua lua

It would change to lua and parse script.lua, then switch back to the old parser.

-- 
Bean




reply via email to

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