Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2c82b2

Browse files
committed
Imported Lua 1.0
1 parent fde02b1 commit e2c82b2

29 files changed

+7064
-0
lines changed

src/Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
OBJS= hash.o inout.o lex_yy.o opcode.o table.o y_tab.o lua.o iolib.o mathlib.o strlib.o
2+
3+
CFLAGS= -O2 -I.
4+
5+
T= lua
6+
7+
all: $T
8+
9+
$T: $(OBJS)
10+
$(CC) -o $@ $(OBJS) -lm
11+
12+
A=--------------------------------------------------------------------------
13+
test: $T
14+
@echo "$A"
15+
./$T sort.lua main
16+
@echo "$A"
17+
./$T globals.lua | sort | column
18+
@echo "$A"
19+
./$T array.lua
20+
@echo "$A"
21+
./$T save.lua
22+
@echo "$A"
23+
./$T test.lua retorno_multiplo norma
24+
25+
clean:
26+
rm -f $T $(OBJS) core core.*
27+
28+
diff:
29+
diff . fixed | grep -v ^Only

src/README

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
This is Lua 1.0. It was never publicly released. This code is a snapshot of
2+
the status of Lua on 28 Jul 1993. It is distributed for historical curiosity
3+
to celebrate 10 years of Lua and is hereby placed in the public domain.
4+
5+
There is no documentation, except the test programs. The manual for Lua 1.1
6+
probably works for this version as well.
7+
8+
The source files for the lexer and parser have been lost: all that is left is
9+
the output of lex and yacc. A grammar can be found inside y_tab.c in yyreds.
10+
11+
The code compiles and runs in RedHat 5.2 with gcc 2.7.2.3. It may not run in
12+
newer systems, because it assumes that stdin and stdout are constants, though
13+
ANSI C does not promise they are. If make fails, try using the fixed modules
14+
provided in the "fixed" directory. To see the differences (which are really
15+
quite minor), do "make diff".
16+
17+
To see Lua 1.0 in action, do "make test". (The last test raises an error on
18+
purpose.)
19+
20+
Enjoy!
21+
22+
-- The Lua team, [email protected]

src/array.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
$debug
2+
3+
a = @()
4+
5+
i=0
6+
while i<10 do
7+
a[i] = i*i
8+
i=i+1
9+
end
10+
11+
r,v = next(a,nil)
12+
while r ~= nil do
13+
print ("array["..r.."] = "..v)
14+
r,v = next(a,r)
15+
end

0 commit comments

Comments
 (0)