Skip to content

Commit

Permalink
coded a lua hello world
Browse files Browse the repository at this point in the history
  • Loading branch information
axkibe committed Oct 14, 2010
1 parent 32d1798 commit 920026e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile.am
@@ -0,0 +1,5 @@
AUTOMAKE_OPTIONS = foreign
CFLAGS = -Wall -pedantic $(LIBLUA_CFLAGS)
bin_PROGRAMS = lsyncd
lsyncd_SOURCES = lsyncd.c
lsyncd_LDADD = $(LIBLUA_LIBS)
9 changes: 9 additions & 0 deletions autogen.sh
@@ -0,0 +1,9 @@
#!/bin/sh

echo "Generating configure files... may take a while."

autoreconf --install --force && \
echo "Preparing was successful if there was no error messages above." && \
echo "Now type:" && \
echo " ./configure && make" && \
echo "Run './configure --help' for more information"
19 changes: 19 additions & 0 deletions configure.ac
@@ -0,0 +1,19 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#AC_PREREQ(2.60)
AC_INIT(lsyncd, 2.0, axkibe@gmail.com)
AC_CONFIG_SRCDIR([lsyncd.c])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE(lsyncd, main)
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
# Checks for libraries.
PKG_CHECK_MODULES(LIBLUA, lua5.1)
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CHECK_HEADERS([sys/inotify.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
25 changes: 25 additions & 0 deletions lsyncd.c
@@ -0,0 +1,25 @@
#include <stdio.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

/* the Lua interpreter */
lua_State* L;

int main (int argc, char *argv[])
{
/* initialize Lua */
L = lua_open();
/* load Lua base libraries */
luaL_openlibs(L);
/* register our function */
//lua_register(L, "average", average);
/* run the script */
luaL_dofile(L, "lsyncd.lua");
/* cleanup Lua */
lua_close(L);
/* pause */
printf( "Press enter to exit..." );
getchar();
return 0;
}
2 changes: 2 additions & 0 deletions lsyncd.lua
@@ -0,0 +1,2 @@
print("Hello\n")

0 comments on commit 920026e

Please sign in to comment.