AB
Size: a a a
AB
AB
AB
YG
YG
AB
AB
YG
S

CP
S
$(".animated_shit").each(
function(i){
$(i).animate(
function() {
this.animate({opacity: "-=.1"})
},
500,
function() { this.opacity: .5 }
}
}
)
Вот этот вот код, если что, нацепил на каждый элемент класса animated_shit минимум четыре объекта: таймер, табличку с данными и две функции. Вместо того чтобы выставить каждому по своему таймеру, но одни и те же две функции, чтобы хотя бы их не дублировать миллиард раз.S
function newObject(x, y, hp)
local obj = {x = x, y = y, hp = hp}
function obj.move(vx, vy)
obj.x = obj.x + vx
obj.y = obj.y + vy
end
function obj.applyDamage(dmg)
obj.hp = obj.hp - dmg
if obj.hp <= 0 then
obj.die()
return true
end
end
function obj.die()
obj.setAnimation(death)
end
return obj
end
А потом наплодить миллиард таких объектов.S
I
S
lua_newtable(L);
lua_pushnumber(L, 10);
lua_rawset(L, -2);S
3.6 – Error Handling in C
Internally, Lua uses the C longjmp facility to handle errors. (You can also choose to use exceptions if you use C++; see file luaconf.h.) When Lua faces any error (such as memory allocation errors, type errors, syntax errors, and runtime errors) it raises an error; that is, it does a long jump. A protected environment uses setjmp to set a recover point; any error jumps to the most recent active recover point.
Most functions in the API can throw an error, for instance due to a memory allocation error. The documentation for each function indicates whether it can throw errors.
Inside a C function you can throw an error by calling lua_error.S