aboutsummaryrefslogtreecommitdiff
path: root/fixed/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'fixed/lua.c')
-rw-r--r--fixed/lua.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/fixed/lua.c b/fixed/lua.c
new file mode 100644
index 00000000..f2cfc0b6
--- /dev/null
+++ b/fixed/lua.c
@@ -0,0 +1,55 @@
1/*
2** lua.c
3** Linguagem para Usuarios de Aplicacao
4** TeCGraf - PUC-Rio
5** 28 Apr 93
6*/
7
8#include <stdio.h>
9
10#include "lua.h"
11#include "lualib.h"
12
13
14void test (void)
15{
16 lua_pushobject(lua_getparam(1));
17 lua_call ("c", 1);
18}
19
20
21static void callfunc (void)
22{
23 lua_Object obj = lua_getparam (1);
24 if (lua_isstring(obj)) lua_call(lua_getstring(obj),0);
25}
26
27static void execstr (void)
28{
29 lua_Object obj = lua_getparam (1);
30 if (lua_isstring(obj)) lua_dostring(lua_getstring(obj));
31}
32
33int main (int argc, char *argv[])
34{
35 int i;
36 if (argc < 2)
37 {
38 puts ("usage: lua filename [functionnames]");
39 return;
40 }
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++)
49 {
50 lua_call (argv[i],0);
51 }
52 return 0;
53}
54
55