[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.2 feature list?
- From: Glenn Maynard <glenn@...>
- Date: Tue, 3 Oct 2006 04:32:23 -0400
On Mon, Oct 02, 2006 at 01:35:36PM -0500, Rici Lake wrote:
> I don't think that's really necessary. It can easily be written
> (although the following code has not actually been tested):
This wouldn't be used by libraries, though: you'd have to modify them to
use it.
I'd like luaL_typerror (or luaL_typename) to try a __type metamethod.
Currently, I have to modify it, so "number expected, got table" can
become "number expected, got Sprite".
> const char *my_pushstringvalue (luaState *L, int obj, size_t *plen) {
> switch (lua_type(L, obj)) {
> case LUA_TSTRING:
> case LUA_TNUMBER:
> lua_pushvalue(L, obj);
> default: {
> if (0 == luaL_callmeta(L, obj, "__string"))
> return NULL;
Maybe for number types, too, for custom number conversions.
--
Glenn Maynard, wishing for the end of 0 == n()