summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-07-05 15:52:07 -0700
committerH. Peter Anvin <hpa@zytor.com>2010-07-05 15:52:07 -0700
commit6afe9a37c790a58a7d7d2e955921ed0a8c9b4fee (patch)
treec5575488ab9ab120f8654314152542794ef06db0
parent0a984adcbd5130e790a774e0d78d66465ecc6c0a (diff)
downloadsyslinux-6afe9a37c790a58a7d7d2e955921ed0a8c9b4fee.tar.gz
syslinux-6afe9a37c790a58a7d7d2e955921ed0a8c9b4fee.tar.xz
syslinux-6afe9a37c790a58a7d7d2e955921ed0a8c9b4fee.zip
lua: change syslinux.sleep() to seconds, syslinux.msleep() to ms
For consistency with just about everything else, make syslinux.sleep() count seconds, and syslinux.msleep() count milliseconds. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/lua/doc/syslinux.asc14
-rw-r--r--com32/lua/src/syslinux.c11
-rw-r--r--com32/lua/test/vesa.lua10
3 files changed, 24 insertions, 11 deletions
diff --git a/com32/lua/doc/syslinux.asc b/com32/lua/doc/syslinux.asc
index 71593066..eb8ca7f1 100644
--- a/com32/lua/doc/syslinux.asc
+++ b/com32/lua/doc/syslinux.asc
@@ -23,7 +23,11 @@ Modules
SYSLINUX
~~~~~~~~
-.syslinux.sleep(ms)
+.syslinux.sleep(s)
+
+Sleep for +s+ seconds
+
+.syslinux.msleep(ms)
Sleep for +ms+ milliseconds
@@ -102,7 +106,7 @@ _Example_:
syslinux.boot_it(kernel, initrd, "init=/bin/bash")
- syslinux.sleep(20000)
+ syslinux.sleep(20)
......................................................
@@ -259,15 +263,15 @@ _Example_:
vesa.load_background("/background1.jpg")
- syslinux.sleep(1000)
+ syslinux.sleep(1)
for i = 1, #textline do
local c = textline:sub(i,i)
printf("%s", c)
- syslinux.sleep(200)
+ syslinux.msleep(200)
end
- syslinux.sleep(10000)
+ syslinux.sleep(10)
......................................................
diff --git a/com32/lua/src/syslinux.c b/com32/lua/src/syslinux.c
index a272fc61..cf0189f9 100644
--- a/com32/lua/src/syslinux.c
+++ b/com32/lua/src/syslinux.c
@@ -280,9 +280,17 @@ static int sl_boot_linux(lua_State * L)
return 0;
}
-/* sleep for msec milliseconds */
+/* sleep for sec seconds */
static int sl_sleep(lua_State * L)
{
+ unsigned int sec = luaL_checkint(L, 1);
+ sleep(sec);
+ return 0;
+}
+
+/* sleep for msec milliseconds */
+static int sl_msleep(lua_State * L)
+{
unsigned int msec = luaL_checkint(L, 1);
msleep(msec);
return 0;
@@ -404,6 +412,7 @@ static const luaL_reg syslinuxlib[] = {
{"boot_linux", sl_boot_linux},
{"run_kernel_image", sl_run_kernel_image},
{"sleep", sl_sleep},
+ {"msleep", sl_msleep},
{"loadfile", sl_loadfile},
{"filesize", sl_filesize},
{"filename", sl_filename},
diff --git a/com32/lua/test/vesa.lua b/com32/lua/test/vesa.lua
index 7f35e5b5..8913accf 100644
--- a/com32/lua/test/vesa.lua
+++ b/com32/lua/test/vesa.lua
@@ -18,7 +18,7 @@ vesa.setmode()
printf("Hello World! - VESA mode")
-syslinux.sleep(1000)
+syslinux.sleep(1)
-- some text to display "typing style"
textline=[[
@@ -39,17 +39,17 @@ while ( true ) do
vesa.load_background("/PXE-RRZE_small.jpg")
-syslinux.sleep(1000)
+syslinux.sleep(1)
for i = 1, #textline do
local c = textline:sub(i,i)
printf("%s", c)
- syslinux.sleep(200)
+ syslinux.msleep(200)
end
-syslinux.sleep(10000)
+syslinux.sleep(10)
vesa.load_background("/sample2.jpg")
-syslinux.sleep(10000)
+syslinux.sleep(10)
end