From 6d88293ea029a2372250297bd014b78d40507aa7 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 23 Feb 2017 11:19:59 +0100 Subject: coroutine.status, coroutine.wrap, coroutine.running, coroutine.isyieldable --- src/lapi.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lapi.js') diff --git a/src/lapi.js b/src/lapi.js index 2f2802f..c841ba2 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -279,6 +279,13 @@ const lua_pushlightuserdata = function(L, p) { assert(L.top <= L.ci.top, "stack overflow"); }; +const lua_pushthread = function(L) { + L.stack[L.top++] = L; + assert(L.top <= L.ci.top, "stack overflow"); + + return L.l_G.mainthread === L; +}; + const lua_pushglobaltable = function(L) { lua_rawgeti(L, lua.LUA_REGISTRYINDEX, lua.LUA_RIDX_GLOBALS); }; @@ -746,6 +753,7 @@ module.exports.lua_pushlstring = lua_pushlstring; module.exports.lua_pushnil = lua_pushnil; module.exports.lua_pushnumber = lua_pushnumber; module.exports.lua_pushstring = lua_pushstring; +module.exports.lua_pushthread = lua_pushthread; module.exports.lua_pushvalue = lua_pushvalue; module.exports.lua_rawequal = lua_rawequal; module.exports.lua_rawget = lua_rawget; -- cgit v1.2.3-54-g00ecf