Skip to content

Commit be5d302

Browse files
author
luarocks
committed
Update proto.copy()
1 parent 5a36c10 commit be5d302

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

example.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ for k, v, t in proto.slots(cat1) do
101101
print(k, v, t)
102102
end
103103

104-
print(proto)
104+
print(proto:copy())

init.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ function proto:copy()
2626
for key, value in proto.slots(self) do
2727
t[key] = value
2828
end
29-
proto.set_name(t, tostring(self))
29+
local mt = getmetatable(self)
30+
if mt then
31+
setmetatable(t, { __tostring = mt.__tostring })
32+
end
3033
return t
3134
end
3235

proto-0.2.2-0.rockspec renamed to proto-0.2.2-1.rockspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- luacheck: no global
22

33
package = "proto"
4-
version = "0.2.2-0"
4+
version = "0.2.2-1"
55
source = {
66
url = "git+ssh://[email protected]/lua-rocks/proto.git",
77
}

0 commit comments

Comments
 (0)