diff --git a/limmutable.c b/limmutable.c index 19d4e80..5208f48 100644 --- a/limmutable.c +++ b/limmutable.c @@ -185,27 +185,27 @@ static int Lindex(lua_State *L) { lua_getmetatable(L, 1); // Stack: [mt] - lua_getfield(L, -1, "__field_positions"); - // Stack: [mt, field_positions] + lua_getfield(L, -1, "__indices"); + // Stack: [mt, indices] lua_pushvalue(L, 2); - // Stack: [mt, field_positions, k] + // Stack: [mt, indices, k] lua_rawget(L, -2); - // Stack: [mt, field_positions, i] + // Stack: [mt, indices, i] if (! lua_isnil(L, -1)) { - // Stack: [mt, field_positions, i] + // Stack: [mt, indices, i] lua_getfield(L, -3, "__instances"); - // Stack: [mt, field_positions, i, buckets] + // Stack: [mt, indices, i, buckets] lua_rawgeti(L, -1, *((lua_Integer*)lua_touserdata(L, 1))); - // Stack: [mt, field_positions, i, buckets, bucket] + // Stack: [mt, indices, i, buckets, bucket] lua_pushvalue(L, 1); - // Stack: [mt, field_positions, i, buckets, bucket, inst_udata] + // Stack: [mt, indices, i, buckets, bucket, inst_udata] lua_rawget(L, -2); - // Stack: [mt, field_positions, i, buckets, bucket, inst_table] + // Stack: [mt, indices, i, buckets, bucket, inst_table] lua_rawgeti(L, -1, lua_tointeger(L, -4)); return 1; } // Fall back to class: - // Stack: [mt, field_positions, i] + // Stack: [mt, indices, i] lua_pop(L, 2); // Stack: [mt] lua_pushvalue(L, 2); @@ -321,7 +321,7 @@ static int Lnext(lua_State *L) // Stack: [mt, buckets, bucket, inst_udata] lua_rawget(L, -2); // Stack: [mt, buckets, bucket, inst_table] - lua_getfield(L, -4, "__field_positions"); + lua_getfield(L, -4, "__indices"); // Stack: [mt, buckets, bucket, inst_table, fields] lua_pushvalue(L, 2); // Stack: [mt, buckets, bucket, inst_table, fields, k] @@ -395,16 +395,16 @@ static int Lmake_class(lua_State *L) size_t n = lua_objlen(L, 1); lua_createtable(L, 0, n); - // Stack: [CLS, __field_positions] + // Stack: [CLS, __indices] lua_pushnil(L); while (lua_next(L, 1) != 0) { - // Stack: [CLS, __field_positions, i, fieldname] + // Stack: [CLS, __indices, i, fieldname] lua_pushvalue(L, -2); - // Stack: [CLS, __field_positions, i, fieldname, i] + // Stack: [CLS, __indices, i, fieldname, i] lua_settable(L, -4); - // Stack: [CLS, __field_positions, i] + // Stack: [CLS, __indices, i] } - lua_setfield(L, -2, "__field_positions"); + lua_setfield(L, -2, "__indices"); // Stack: [CLS] // If methods were passed in, copy them over