+Hügh Posted March 24, 2021 Posted March 24, 2021 (edited) @fm34 and I spent some time debugging a cartridge of his. After a while, he narrowed it down to the usage of setmetatable and getmetatable in a table deepcopy function. I'm certain that I've seen setmetatable and getmetatable used before. Why has it stopped working? Edited March 24, 2021 by Hügh Quote
+Hügh Posted March 24, 2021 Author Posted March 24, 2021 For context, the following cartridge is "valid" and compiles correctly... require "Wherigo" ZonePoint = Wherigo.ZonePoint Distance = Wherigo.Distance Player = Wherigo.Player _cartridge = Wherigo.ZCartridge() _cartridge.Id = "00000000000000000000000000001337" _cartridge.Name = "Sandbox" _cartridge.Activity = "Geocache" _cartridge.Version = "" _cartridge.Company = "" _cartridge.Author = "Hugh" _cartridge.TargetDevice = "SmartPhone" _cartridge.TargetDeviceVersion = "0" _cartridge.BuilderVersion = "1" _cartridge.StateId = "1" _cartridge.CountryId = "2" _cartridge.Description = [[A sandbox.]] _cartridge.StartingLocationDescription = [[]] _cartridge.Visible = true _cartridge.Complete = false _cartridge.UseLogging = false _cartridge.CreateDate = "12/25/2020 04:02:56 AM" _cartridge.PublishDate = "1/1/1970 01:00:00 AM" _cartridge.UpdateDate = "12/25/2020 04:06:27 AM" _cartridge.LastPlayedDate = "1/1/1970 01:00:00 AM" _cartridge.StartingLocation = Wherigo.INVALID_ZONEPOINT function f(_object) local _copy = {} return _copy end return _cartridge But, the following do not. require "Wherigo" ZonePoint = Wherigo.ZonePoint Distance = Wherigo.Distance Player = Wherigo.Player _cartridge = Wherigo.ZCartridge() _cartridge.Id = "00000000000000000000000000001337" -- SNIP _cartridge.StartingLocation = Wherigo.INVALID_ZONEPOINT function f(_object) local _copy = {} setmetatable(_copy, nil) return _copy end return _cartridge require "Wherigo" ZonePoint = Wherigo.ZonePoint Distance = Wherigo.Distance Player = Wherigo.Player _cartridge = Wherigo.ZCartridge() _cartridge.Id = "00000000000000000000000000001337" -- SNIP _cartridge.StartingLocation = Wherigo.INVALID_ZONEPOINT function f(_object) local _copy = {} setmetatable(_copy, {}) return _copy end return _cartridge Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.