-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.txt
More file actions
33 lines (25 loc) · 863 Bytes
/
README.txt
File metadata and controls
33 lines (25 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Python-like range object for Lua.
Has similar semantics to Python's (x)range:
range(stop)
range(start, stop)
range(start, stop, step)
Comes with a Lua implementation that uses a table.
Library functions:
range() --> same as range.new()
new([start, ] stop [, step]) --> new range object
bless(table) --> (Lua-only) turn table into range object
Methods:
[Metamethods]
tostring(obj) --> "range(...)"
#obj --> number of items in range
ipairs(obj) --> iterator over range
obj[index] --> same as obj:get(index)
[Regular methods]
(The first three are fields in the Lua implementation.)
start --> first number in the range
stop --> last number in the range
step --> interval size of the range
get(index) --> get range item at index
totable --> convert range to a table sequence/list
C source coded for Lua 5.2.
--benpop--