Giter Site home page Giter Site logo

lua-range's Introduction

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--

lua-range's People

Contributors

benpop avatar

Watchers

James Cloos avatar Androlua avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.