From cd05d9c5cb69020c069f037ba7f243f705d0a48a Mon Sep 17 00:00:00 2001 From: The Lua team Date: Wed, 28 Jul 1993 10:18:00 -0300 Subject: oldest known commit --- lua.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 lua.c (limited to 'lua.c') diff --git a/lua.c b/lua.c new file mode 100644 index 00000000..be01b70f --- /dev/null +++ b/lua.c @@ -0,0 +1,54 @@ +/* +** lua.c +** Linguagem para Usuarios de Aplicacao +** TeCGraf - PUC-Rio +** 28 Apr 93 +*/ + +#include + +#include "lua.h" +#include "lualib.h" + + +void test (void) +{ + lua_pushobject(lua_getparam(1)); + lua_call ("c", 1); +} + + +static void callfunc (void) +{ + lua_Object obj = lua_getparam (1); + if (lua_isstring(obj)) lua_call(lua_getstring(obj),0); +} + +static void execstr (void) +{ + lua_Object obj = lua_getparam (1); + if (lua_isstring(obj)) lua_dostring(lua_getstring(obj)); +} + +void main (int argc, char *argv[]) +{ + int i; + if (argc < 2) + { + puts ("usage: lua filename [functionnames]"); + return; + } + lua_register ("callfunc", callfunc); + lua_register ("execstr", execstr); + lua_register ("test", test); + iolib_open (); + strlib_open (); + mathlib_open (); + lua_dofile (argv[1]); + for (i=2; i