1
2
3
4
2
3
4
amazing={badvariable=0,worsevariable="banana bonanza"} incredible={} incredible:insert(amazing)
amazing={badvariable=0,worsevariable="banana bonanza"} incredible={} incredible:insert(amazing)
amazing={ 	badvariable = 0; 	worsevariable = "banana bonanza"; } incredible={} for _, i in pairs(amazing) do 	table.insert(incredible,amazing[i]) end
table.refinsert = function(tbl,tbl2,ref) 	for k,v in pairs(tbl2) do 		tbl[ref[k]]=v 	end end amazing={badvariable=0,worsevariable="banana bonanza"} incredible={} referencetable = {badvariable=5,worsevariable=16} -- move badvariable to index 5, worsevariable - to index 16 table.refinsert(incredible,amazing,referencetable)
languages = { 	new = function(t, base, init) 		local r = {} 		for k,v in pairs(base) do 			--copy the table taking either the default value or overwrite if possible 			r[k] = init[k] or v 		end 		table.insert(t,r) 		return r 	end } --no third variable needed english = languages:new({hello="hello", bye="bye", yes="yes", no="no"}) --no 'no' key needed, because 'no' in spanish is written just like in english spanish = languages:new(english, {hello="hola", bye="adios", yes="si"})
amazing={blah=0,blah2=""} incredible={} ... 	local r=table.copy(amazing) 	r[blah]=notzero 	r[blah2]=notempty 	or 	for k,v in pairs(newvalues) do 		r[k]=v 	end 	incredible:insert(r) ...