/******************************************************************************
 * $Id: getdate_lua.c,v 1.4 2006/01/13 21:46:54 gareuselesinge Exp $
 * This file is part of FreePOPs (http://www.freepops.org)                    *
 * This file is distributed under the terms of GNU GPL license.               *
 ******************************************************************************/

/******************************************************************************
 * File description:
 *	getdate lua bindings
 * Notes:
 *	
 * Authors:
 * 	Name <gareuselesinge@users.sourceforge.net>
 ******************************************************************************/
#include <lauxlib.h>
#include <lua.h>

#include "getdate.h"
#include "compat-5.1.h"

static int L_getdate(lua_State* L){
const char * s = luaL_checkstring(L,1);
long int rc;

if( lua_gettop(L) != 1 )
	luaL_error(L,"getdate wnats only one argument (string)");

rc = gd_getdate(s,NULL);

lua_pushnumber(L,rc);

return 1;
}

static const struct luaL_reg getdate_f [] = {
  {"toint",L_getdate},
  {NULL,NULL}
};

int luaopen_getdate(lua_State* L) {
	
	luaL_openlib(L,"getdate",getdate_f,0);

	return 1;
}



syntax highlighted by Code2HTML, v. 0.9.1