coded a lua hello world

This commit is contained in:
Axel Kittenberger 2010-10-14 13:52:01 +00:00
parent 32d1798652
commit 920026efeb
5 changed files with 60 additions and 0 deletions

5
Makefile.am Normal file
View File

@ -0,0 +1,5 @@
AUTOMAKE_OPTIONS = foreign
CFLAGS = -Wall -pedantic $(LIBLUA_CFLAGS)
bin_PROGRAMS = lsyncd
lsyncd_SOURCES = lsyncd.c
lsyncd_LDADD = $(LIBLUA_LIBS)

9
autogen.sh Executable file
View File

@ -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
configure.ac Normal file
View File

@ -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
lsyncd.c Normal file
View File

@ -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
lsyncd.lua Normal file
View File

@ -0,0 +1,2 @@
print("Hello\n")