Imported from ../lua-1.0.tar.gz.
[lua.git] / lua.c
blobbe01b70f024abcbef8f76a053b81df24cbb3bea1
1 /*
2 ** lua.c
3 ** Linguagem para Usuarios de Aplicacao
4 ** TeCGraf - PUC-Rio
5 ** 28 Apr 93
6 */
8 #include <stdio.h>
10 #include "lua.h"
11 #include "lualib.h"
14 void test (void)
16 lua_pushobject(lua_getparam(1));
17 lua_call ("c", 1);
21 static void callfunc (void)
23 lua_Object obj = lua_getparam (1);
24 if (lua_isstring(obj)) lua_call(lua_getstring(obj),0);
27 static void execstr (void)
29 lua_Object obj = lua_getparam (1);
30 if (lua_isstring(obj)) lua_dostring(lua_getstring(obj));
33 void main (int argc, char *argv[])
35 int i;
36 if (argc < 2)
38 puts ("usage: lua filename [functionnames]");
39 return;
41 lua_register ("callfunc", callfunc);
42 lua_register ("execstr", execstr);
43 lua_register ("test", test);
44 iolib_open ();
45 strlib_open ();
46 mathlib_open ();
47 lua_dofile (argv[1]);
48 for (i=2; i<argc; i++)
50 lua_call (argv[i],0);