Deques now have metatables, fixed deque unit tests
This commit is contained in:
@@ -204,11 +204,11 @@ int deque_make_room(lua_State *L, int deque, int left, int fill, int max) {
|
||||
return max;
|
||||
}
|
||||
|
||||
|
||||
LuaDefine(deque_create, "c") {
|
||||
LuaRet rdeque;
|
||||
LuaStack LS(L, rdeque);
|
||||
const int imax = 8;
|
||||
LuaVar classobj;
|
||||
LuaStack LS(L, rdeque, classobj);
|
||||
const int imax = 4;
|
||||
LS.createtable(rdeque, DEQUE_BASE + imax - 1, 0);
|
||||
LS.rawseti(rdeque, DEQUE_LEFT, 0);
|
||||
LS.rawseti(rdeque, DEQUE_FILL, 0);
|
||||
@@ -216,6 +216,8 @@ LuaDefine(deque_create, "c") {
|
||||
for (int i = 0; i < imax; i++) {
|
||||
LS.rawseti(rdeque, DEQUE_BASE + i, 0);
|
||||
}
|
||||
LS.makeclass(classobj, "deque");
|
||||
LS.setmetatable(rdeque, classobj);
|
||||
return LS.result();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user