Home / profesionalni-seznamka Seznamka / Begin or keeps the delivery of coroutine co

Begin or keeps the delivery of coroutine co

Begin or keeps the delivery of coroutine co

The 1st time your resume a coroutine, it begins operating its system. The standards val1 , A·A·A· become passed because the arguments on the muscles work. If coroutine enjoys produced, resume restarts it; the prices vidД›t strГЎnka val1 , A·A·A· include passed away given that results from the give.

If coroutine operates without any mistakes, resume returns genuine plus any principles passed to deliver (in the event that coroutine produces) or any prices returned by system work (if the coroutine terminates). If you have any error, resume comes back untrue in addition to the mistake content.

coroutine.status (co)

Returns the updates of coroutine co , as a string: “running” , if the coroutine is running (that’s, they labeled as standing ); “dangling” , if the coroutine was dangling in a phone call to give , or if it has perhaps not going running yet; “normal” in the event the coroutine is active not working (definitely, it’s started again another coroutine); and “dead” in the event the coroutine possess finished the system purpose, or if it offers stopped with a mistake.

coroutine.wrap (f)

Produces an innovative new coroutine, with body f . f should be a Lua features. Returns a function that resumes the coroutine everytime it’s also known as. Any arguments passed to your function behave as the excess arguments to resume . Returns exactly the same principles returned by resume , except the very first boolean. In case of error, propagates the mistake.

coroutine.yield (A·A·A·)

Suspends the delivery associated with calling coroutine. The coroutine shouldn’t be running a C purpose, a metamethod, or an iterator. Any arguments to produce is passed as higher results to resume .

5.3 Modules

The package collection supplies standard services for running and strengthening modules in Lua. It exports a couple of their features straight in the international environment: need and module . All the rest of it try exported in a table package .

module (name [, A·A·A·])

Produces a module. When there is a dining table in bundle.loaded[name] , this table may be the module. Or else, if you have a major international table t with the considering term, this dining table may be the module. Normally produces a fresh dining table t and kits it the value of the worldwide title as well as the value of bundle.loaded[name] . This features additionally initializes t._NAME using the offered identity, t._M utilizing the component ( t alone), and t._PACKAGE using plan identity (the complete module identity minus latest aspect; discover below). Eventually, module sets t as the latest planet regarding the present purpose in addition to newer property value bundle.loaded[name] , to make sure that need comes back t .

If name’s a substance title (which, one with elements divided by dots), component brings about (or reuses, as long as they currently exists) tables each aspect. As an instance, if name’s a.b.c , then module shop the module desk in field c of field b of international a .

This features can obtain elective options following component name, where each choice is a work as used across the component.

require (modname)

Lots the given module. The event starts by looking into the package.loaded table to find out whether modname is loaded. If it is, after that require returns the worth put at plan.loaded[modname] . Or else, it attempts to look for a loader for module.

To track down a loader, call for are guided of the plan.loaders collection. By switching this selection, we can transform just how require searches for a module. The following reason is dependent on the standard arrangement for bundle.loaders .

Initially call for questions package.preload[modname] . If this possess a benefits, this advantages (that should feel a function) will be the loader. If not need searches for a Lua loader by using the route stored in package.path . If that in addition fails, they looks for a C loader utilizing the route kept in bundle.cpath . If it in addition fails, they tries an all-in-one loader (see plan.loaders ).