Merge branch 'MihailRis:main' into main
This commit is contained in:
commit
877bf25f9a
@ -413,15 +413,9 @@ end
|
||||
local __vc_coroutines = {}
|
||||
local __vc_named_coroutines = {}
|
||||
local __vc_next_coroutine = 1
|
||||
local __vc_coroutine_error = nil
|
||||
|
||||
function __vc_start_coroutine(chunk)
|
||||
local co = coroutine.create(function()
|
||||
local status, err = pcall(chunk)
|
||||
if not status then
|
||||
__vc_coroutine_error = err
|
||||
end
|
||||
end)
|
||||
local co = coroutine.create(chunk)
|
||||
local id = __vc_next_coroutine
|
||||
__vc_next_coroutine = __vc_next_coroutine + 1
|
||||
__vc_coroutines[id] = co
|
||||
@ -431,10 +425,10 @@ end
|
||||
function __vc_resume_coroutine(id)
|
||||
local co = __vc_coroutines[id]
|
||||
if co then
|
||||
coroutine.resume(co)
|
||||
if __vc_coroutine_error then
|
||||
debug.error(__vc_coroutine_error)
|
||||
error(__vc_coroutine_error)
|
||||
local success, err = coroutine.resume(co)
|
||||
if not success then
|
||||
debug.error(err)
|
||||
error(err)
|
||||
end
|
||||
return coroutine.status(co) ~= "dead"
|
||||
end
|
||||
|
||||
@ -20,6 +20,9 @@ void main() {
|
||||
if (alpha < 0.2f)
|
||||
discard;
|
||||
alpha = 1.0;
|
||||
} else {
|
||||
if (alpha < 0.002f)
|
||||
discard;
|
||||
}
|
||||
f_color = mix(a_color * tex_color, vec4(fogColor,1.0),
|
||||
min(1.0, pow(depth*u_fogFactor, u_fogCurve)));
|
||||
|
||||
@ -113,8 +113,9 @@ public:
|
||||
auto start = currentLocation();
|
||||
if (is_lua_identifier_start(c)) {
|
||||
auto name = parseLuaName();
|
||||
TokenTag tag = (is_lua_keyword(name) ? TokenTag::KEYWORD : TokenTag::NAME);
|
||||
emitToken(
|
||||
is_lua_keyword(name) ? TokenTag::KEYWORD : TokenTag::NAME,
|
||||
tag,
|
||||
std::move(name),
|
||||
start
|
||||
);
|
||||
|
||||
@ -89,7 +89,8 @@ static int l_closeserver(lua::State* L) {
|
||||
static int l_send(lua::State* L) {
|
||||
u64id_t id = lua::tointeger(L, 1);
|
||||
auto connection = engine->getNetwork().getConnection(id);
|
||||
if (connection == nullptr) {
|
||||
if (connection == nullptr ||
|
||||
connection->getState() == network::ConnectionState::CLOSED) {
|
||||
return 0;
|
||||
}
|
||||
if (lua::istable(L, 2)) {
|
||||
@ -167,7 +168,9 @@ static int l_is_alive(lua::State* L) {
|
||||
u64id_t id = lua::tointeger(L, 1);
|
||||
if (auto connection = engine->getNetwork().getConnection(id)) {
|
||||
return lua::pushboolean(
|
||||
L, connection->getState() != network::ConnectionState::CLOSED
|
||||
L,
|
||||
connection->getState() != network::ConnectionState::CLOSED ||
|
||||
connection->available() > 0
|
||||
);
|
||||
}
|
||||
return lua::pushboolean(L, false);
|
||||
|
||||
@ -270,12 +270,13 @@ scripting::common_func lua::create_lambda(State* L) {
|
||||
return [=](const std::vector<dv::value>& args) -> dv::value {
|
||||
if (!get_from(L, LAMBDAS_TABLE, *funcptr, false))
|
||||
return nullptr;
|
||||
int top = gettop(L) + 1;
|
||||
int top = gettop(L) - 1;
|
||||
for (const auto& arg : args) {
|
||||
pushvalue(L, arg);
|
||||
}
|
||||
if (call(L, args.size(), 1)) {
|
||||
int nres = gettop(L) - top;
|
||||
assert(nres >= 0);
|
||||
if (nres) {
|
||||
auto result = tovalue(L, -1);
|
||||
pop(L, 1 + nres);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user