lua.c
changeset 148 b222f4d111d9
parent 147 66a63c9609de
child 151 5d90caa7fb2c
equal deleted inserted replaced
147:66a63c9609de 148:b222f4d111d9
     1 
     1 
     2 /* Copyright 2009-2012 Myhailo Danylenko
     2 /* Copyright 2009-2016 Myhailo Danylenko
     3  * Copyright 2011      Mikael Berthe
     3  * Copyright 2011      Mikael Berthe
     4 
     4 
     5 This file is part of mcabber-lua.
     5 This file is part of mcabber-lua.
     6 
     6 
     7 mcabber-lua is free software: you can redistribute it and/or modify
     7 mcabber-lua is free software: you can redistribute it and/or modify
    70 	LUA_RELEASE " scripting interface\n" \
    70 	LUA_RELEASE " scripting interface\n" \
    71 	"Options: " OPT_MLUA_RC "\n" \
    71 	"Options: " OPT_MLUA_RC "\n" \
    72 	"Command: /" MLUA_COMMAND_NAME )
    72 	"Command: /" MLUA_COMMAND_NAME )
    73 #endif
    73 #endif
    74 
    74 
    75 module_info_t info_lua52 = {
    75 module_info_t MODULE_STRUCT = {
    76 	.branch      = MCABBER_BRANCH,
    76 	.branch      = MCABBER_BRANCH,
    77 	.api         = MCABBER_API_VERSION,
    77 	.api         = MCABBER_API_VERSION,
    78 	.version     = PROJECT_VERSION,
    78 	.version     = PROJECT_VERSION,
    79 	.description = DESCRIPTION,
    79 	.description = DESCRIPTION,
    80 	.requires    = NULL,
    80 	.requires    = NULL,
  1209 /// main.timer
  1209 /// main.timer
  1210 /// Creates new timer function, that will be called periodically.
  1210 /// Creates new timer function, that will be called periodically.
  1211 /// A: integer (interval, seconds), timer function
  1211 /// A: integer (interval, seconds), timer function
  1212 static int lua_main_timer (lua_State *L)
  1212 static int lua_main_timer (lua_State *L)
  1213 {
  1213 {
  1214 	int                   interval = luaL_checkint (L, 1);
  1214 	int                   interval = luaL_checkinteger (L, 1);
  1215 	guint                 source;
  1215 	guint                 source;
  1216 	lua_timer_callback_t *cb;
  1216 	lua_timer_callback_t *cb;
  1217 	luaL_argcheck (L, lua_isfunction (L, 2), 2, "function expected");
  1217 	luaL_argcheck (L, lua_isfunction (L, 2), 2, "function expected");
  1218 
  1218 
  1219 	cb = luaL_malloc (L, sizeof (lua_timer_callback_t));
  1219 	cb = luaL_malloc (L, sizeof (lua_timer_callback_t));