[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: prawget etc?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 4 Oct 2013 08:59:31 +0200
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?