Git Product home page Git Product logo

unsafe-coroutines's Introduction

Installation

Just drop it in and require!

Usage

This library mirrors the functionality of Lua's coroutine library.

local ucoroutine = require 'ucoroutine'

local cr = ucoroutine.create(function()
  print("hello")
  coroutine.yield()
  print("goodbye")
end)
ucoroutine.resume(cr) -- hello
ucoroutine.resume(cr) -- goodbye

Error Messages

Error: main.lua:22: attempt to perform arithmetic on a nil value
stack traceback:
  main.lua:8: in function 'troll'
  main.lua:16: in coroutine <main.lua:15>
  main.lua:11: in function 'do_the_thing'
  main.lua:18: in coroutine <main.lua:14>
  main.lua:20: in coroutine <main.lua:13>
  main.lua:22: in function 'load'

Documentation

cr = ucoroutine.create(f)

Returns a coroutine with error handling capabilities.

results... = ucoroutine.resume(cr, ...)

Resume a coroutine "unsafely," meaning it will automatically error if any problems occur.

f = ucoroutine.wrap(f)

Wraps a coroutine in a closure so it can be called like any normal function.

unsafe-coroutines's People

Contributors

babulous avatar

Watchers

 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.