Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Nice joke.
[simgrid.git] / src / bindings / lua / simgrid_lua.c
index dccdf8a..76a482e 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua, bindings, "Lua Bindings");
 
-#define TASK_MODULE_NAME "simgrid.Task"
-#define HOST_MODULE_NAME "simgrid.Host"
+#define TASK_MODULE_NAME "simgrid.task"
+#define HOST_MODULE_NAME "simgrid.host"
 // Surf (bypass XML)
-#define LINK_MODULE_NAME "simgrid.Link"
-#define ROUTE_MODULE_NAME "simgrid.Route"
+#define LINK_MODULE_NAME "simgrid.link"
+#define ROUTE_MODULE_NAME "simgrid.route"
 #define PLATF_MODULE_NAME "simgrid.platf"
 
 static lua_State* sglua_maestro_state;
@@ -255,7 +255,7 @@ static int l_task_tostring(lua_State* L)
   return 1;
 }
 
-static const luaL_reg Task_meta[] = {
+static const luaL_reg task_meta[] = {
   {"__gc", l_task_gc},
   {"__tostring", l_task_tostring},
   {NULL, NULL}
@@ -441,28 +441,20 @@ static int gras_generate(lua_State * L)
  * Host Methods
  */
 static const luaL_reg host_functions[] = {
-  {"getByName", l_host_get_by_name},
+  {"get_by_name", l_host_get_by_name},
   {"name", l_host_get_name},
   {"number", l_host_number},
   {"at", l_host_at},
   {"self", l_host_self},
-  {"getPropValue", l_host_get_property_value},
+  {"get_prop_value", l_host_get_property_value},
   {"sleep", l_host_sleep},
   {"destroy", l_host_destroy},
   // Bypass XML Methods
-  {"setFunction", console_set_function},
-  {"setProperty", console_host_set_property},
+  {"set_function", console_set_function},
+  {"set_property", console_host_set_property},
   {NULL, NULL}
 };
 
-static int l_host_gc(lua_State * L)
-{
-  m_host_t ht = sglua_checkhost(L, -1);
-  if (ht)
-    ht = NULL;
-  return 0;
-}
-
 static int l_host_tostring(lua_State * L)
 {
   lua_pushfstring(L, "Host :%p", lua_touserdata(L, 1));
@@ -470,7 +462,6 @@ static int l_host_tostring(lua_State * L)
 }
 
 static const luaL_reg host_meta[] = {
-  {"__gc", l_host_gc},
   {"__tostring", l_host_tostring},
   {0, 0}
 };
@@ -752,7 +743,7 @@ void register_c_functions(lua_State *L) {
   /* register the task methods to lua */
   luaL_openlib(L, TASK_MODULE_NAME, task_functions, 0);   // create methods table, add it to the globals
   luaL_newmetatable(L, TASK_MODULE_NAME);       // create metatable for Task, add it to the Lua registry
-  luaL_openlib(L, 0, Task_meta, 0);     // fill metatable
+  luaL_openlib(L, 0, task_meta, 0);     // fill metatable
   lua_pushliteral(L, "__index");
   lua_pushvalue(L, -3);         // dup methods table
   lua_rawset(L, -3);            // metatable.__index = methods