summaryrefslogtreecommitdiffstats
path: root/lua/examples/inspect_vm.lua
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-20 16:20:12 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-20 16:34:23 +0000
commitca488a6d7b6f5701b63249d5a0c73eada09c432c (patch)
tree85eba69be93a141a99b040a27e74ac61ba54c6c8 /lua/examples/inspect_vm.lua
parent8f80f9fdae13a320da978dffa2c9d94e7b68a810 (diff)
downloadlibguestfs-ca488a6d7b6f5701b63249d5a0c73eada09c432c.tar.gz
libguestfs-ca488a6d7b6f5701b63249d5a0c73eada09c432c.tar.xz
libguestfs-ca488a6d7b6f5701b63249d5a0c73eada09c432c.zip
lua: Various fixes to the bindings (thanks Jerome Vuarand).
See http://article.gmane.org/gmane.comp.lang.lua.general/95065 Note that this is incompatible with existing code. You have to do: local G = require "guestfs" local g = G.create () ie. give the module your own name ("G" in that example).
Diffstat (limited to 'lua/examples/inspect_vm.lua')
-rw-r--r--lua/examples/inspect_vm.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/lua/examples/inspect_vm.lua b/lua/examples/inspect_vm.lua
index 1bee10b3..e35b4631 100644
--- a/lua/examples/inspect_vm.lua
+++ b/lua/examples/inspect_vm.lua
@@ -1,6 +1,6 @@
-- Example showing how to inspect a virtual machine disk.
-require "guestfs"
+local G = require "guestfs"
if table.getn (arg) == 1 then
disk = arg[1]
@@ -8,7 +8,7 @@ else
error ("usage: inspect_vm disk.img")
end
-g = Guestfs.create ()
+local g = G.create ()
-- Attach the disk image read-only to libguestfs.
g:add_drive (disk, { -- format:"raw"
@@ -18,7 +18,7 @@ g:add_drive (disk, { -- format:"raw"
g:launch ()
-- Ask libguestfs to inspect for operating systems.
-roots = g:inspect_os ()
+local roots = g:inspect_os ()
if table.getn (roots) == 0 then
error ("inspect_vm: no operating systems found")
end