From bc03a48c7132c75072003fcdd54930db3b70721e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 19 Nov 2012 17:06:21 +0000 Subject: lua: Add global Guestfs.event_all (list of all events). --- generator/lua.ml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'generator/lua.ml') diff --git a/generator/lua.ml b/generator/lua.ml index fbb4e93a..2b3e4a57 100644 --- a/generator/lua.ml +++ b/generator/lua.ml @@ -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.\"); -- cgit