Class: Rufus::Lua::Coroutine

Inherits:
Ref
  • Object
show all
Defined in:
lib/rufus/lua/objects.rb

Overview

(coming soon)

Constant Summary

Constants included from StateMixin

StateMixin::LUA_ENVIRONINDEX, StateMixin::LUA_GLOBALSINDEX, StateMixin::LUA_MULTRET, StateMixin::LUA_NOREF, StateMixin::LUA_REFNIL, StateMixin::LUA_REGISTRYINDEX, StateMixin::TBOOLEAN, StateMixin::TFUNCTION, StateMixin::TLIGHTUSERDATA, StateMixin::TNIL, StateMixin::TNONE, StateMixin::TNUMBER, StateMixin::TSTRING, StateMixin::TTABLE, StateMixin::TTHREAD, StateMixin::TUSERDATA

Instance Attribute Summary

Attributes inherited from Ref

#ref

Instance Method Summary collapse

Methods inherited from Ref

#free, #initialize

Constructor Details

This class inherits a constructor from Rufus::Lua::Ref

Instance Method Details

#resume(*args) ⇒ Object

Resumes the coroutine



114
115
116
117
118
119
120
121
122
123
124
# File 'lib/rufus/lua/objects.rb', line 114

def resume (*args)

  bottom = stack_top

  fetch_library_method('coroutine.resume').load_onto_stack

  load_onto_stack
  args.each { |arg| stack_push(arg) }

  pcall(bottom, args.length + 1)
end

#statusObject

Returns the string status of the coroutine : suspended/running/dead/normal



130
131
132
133
134
135
136
137
138
# File 'lib/rufus/lua/objects.rb', line 130

def status

  bottom = stack_top

  fetch_library_method('coroutine.status').load_onto_stack
  load_onto_stack

  pcall(bottom, 1)
end