| 123456789101112131415161718192021 |
- local t1 = {}
- local s_t = {}
- function func(o, k, v)
- print(o, k, v)
- if t1[k] then
- print("error: msg define repeat! type:" .. k)
- end
- t1[k] = v
- end
- local m = {__newindex = func}
- setmetatable(s_t, m)
- s_t.name = "test"
- s_t.name = 2
- print(t1.name)
- os.execute("PAUSE")
|