lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
> And how do these values pass through the API?

Heavy userdata I guess- that would be up to the implementation. I
believe all the operators on those *int64s could be done via the Lua C
API as-is (type would return userdata in that case, another function
that would inform the user about signedness, depending on its
metatable --similar to LuaJIT's ffi.typeof-- would probably be useful
--inside the bit-module, maybe?-- or just restrict oneself to uint64,
which would simplify bit*- functions).

Functions to conveniently access the whole thing from the C side could
be added without breaking things, e.g.
    int64_t lua_toint64 (lua_State *L, int index); /* convert the
value at index? Unsure what's best. */
    int64_t lua_touint64 (lua_State *L, int index); /* convert the
value at index? Unsure what's best. */
    int64_t luaL_checkint64 (lua_State *L, int index);
    uint64_t luaL_checkuint64_t (lua_State *L, int index);
    void lua_pushint64 (lua_State *L, int64_t n);
    void lua_pushuint64 (lua_State *L, uint64_t n);

    int lua_isint64(lua_State *L, int index); /* return 1 for both
int64 and uint64, for consistency with light/heavy userdata
distinction? Unsure what's best. */
    int lua_isuint64(lua_State *L, int index);

Oh, and scratch the second "my bad" on my last post. A hundred billion
neurons, 20 watts standby power and 200 bytes of L1 cache at best (no
auto refresh!)- my employer would have *crucified* me -.-

--Wolfgang