[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua crashes with 64-bit integers
- From: "Todor Totev" <umbra.tenebris@...>
- Date: Thu, 03 Aug 2006 17:37:14 +0300
i'm using Lua 5.0.2 with lua_Number defined as __int64
Now, the simple expression
=1/0
crashes Lua interpreter with Division by zero exception.
I'd like to catch this exception and convert it to lua error.
Refedine luai_numdiv to test for 0 divisor.
Unfortunatelly in 5.0 there's no luai_* functions.
I found this code in lvm.c:
case OP_DIV: {
TObject *rb = RKB(i);
TObject *rc = RKC(i);
if (ttisnumber(rb) && ttisnumber(rc)) {
setnvalue(ra, nvalue(rb) / nvalue(rc));
}
else
Arith(L, ra, rb, rc, TM_DIV);
break;
Ok, I can check for 0, but how can I generate error to Lua?
I'd like the script to end but the interpreter to continue working.
Regards,
Todor