lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Look at this:

> print(pcall(0,1,2))

false    attempt to call a number value

I.e. `pcall` can't fail. My program retains control.

But now this:

> print(rawget(0,1,2))
stdin:1: bad argument #1 to 'rawget' (table expected, got number)

To get something non-failing, I need to wrap the 'rawget' in a test inside
a test for table-ness.

Next time this annoys me enough, I'll write a little module in C that
provides `prawget` and `prawset`, which stand in the same relationship
to `rawget` and `rawset` as `pcall` stands to `call`.

Unless someone has already done it?