os.shutdown()
3
Post code tricks here!
Started by martin509, Mar 25 2013 11:35 AM
44 replies to this topic
#41
Posted 02 April 2013 - 03:13 PM
My lua trick
#43
Posted 03 April 2013 - 01:22 PM
With this bit of code:
local tbl = setmetatable({}, { __index = function(self, index) if not rawget(self, index) then rawset(self, index, {}) else return rawget(self, index) end end })you can have a 2-dimensional table without worrying about setting (for example) tbl[1] before setting tbl[1][5]. You could probably also put the code inside itself to make 3D tables... metatableception?
#45
Posted 03 April 2013 - 04:06 PM
Imgoodisher, on 03 April 2013 - 01:22 PM, said:
also put the code inside itself to make 3D tables... metatableception?
anyway heres your metatableception:
rawset(self,index,setmetatable({},getmetatable(self))
i used a bit of that here
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users