mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
lua: Add global Guestfs.event_all (list of all events).
This commit is contained in:
@@ -729,6 +729,16 @@ push_event (lua_State *L, uint64_t event)
|
||||
pr " abort (); /* should never happen */
|
||||
}
|
||||
|
||||
static const char *event_all[] = {
|
||||
";
|
||||
|
||||
List.iter (
|
||||
fun (event, _) -> pr " \"%s\",\n" event
|
||||
) events;
|
||||
|
||||
pr " NULL
|
||||
};
|
||||
|
||||
";
|
||||
|
||||
(* Code to push structs. *)
|
||||
@@ -839,6 +849,11 @@ luaopen_guestfs (lua_State *L)
|
||||
lua_pushvalue (L, -1);
|
||||
lua_setfield (L, -1, \"__index\");
|
||||
|
||||
/* Globals in the Guestfs.* namespace. */
|
||||
lua_pushliteral (L, \"event_all\");
|
||||
push_string_list (L, (char **) event_all);
|
||||
lua_settable (L, -3);
|
||||
|
||||
/* Add _COPYRIGHT, etc. fields to the metatable. */
|
||||
lua_pushliteral (L, \"_COPYRIGHT\");
|
||||
lua_pushliteral (L, \"Copyright (C) %s Red Hat Inc.\");
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
require "guestfs"
|
||||
|
||||
for i, v in ipairs (Guestfs.event_all) do
|
||||
print (i, v)
|
||||
end
|
||||
|
||||
g = Guestfs.create ()
|
||||
|
||||
function log_callback (g, event, eh, flags, buf, array)
|
||||
|
||||
Reference in New Issue
Block a user