How to override default values with region specific values in terraform for OCI NoSQL table configuration - terraform
I want the below map as to be my default values
```locals {
defaults = {
nosql = {
table1 = {
read_units = 20
write_units = 20
storage_gb = 5
}
table2 = {
read_units = 200
write_units = 200
storage_gb = 2
}
table3 = {
read_units = 10
write_units = 10
storage_gb = 1
}
table4 = {
read_units = 10
write_units = 10
storage_gb = 1
}
table5 = {
read_units = 100
write_units = 200
storage_gb = 1
}
table6 = {
read_units = 10
write_units = 10
storage_gb = 1
}
table7 = {
read_units = 10
write_units = 10
storage_gb = 1
}
table8 = {
read_units = 3000
write_units = 3000
storage_gb = 50
}
table9 = {
read_units = 400
write_units = 400
storage_gb = 5
}
table10 = {
read_units = 960
write_units = 860
storage_gb = 20
}
}
}
}```
And I want the below values map to be used to override in a specific region
us-phoenix-1 = {
table1 = {
read_units = 200
write_units = 200
storage_gb = 50
}
table2 = {
read_units = 2000
write_units = 2000
storage_gb = 2
}
table3 = {
read_units = 100
write_units = 10
storage_gb = 1
}
table4 = {
read_units = 10
write_units = 100
storage_gb = 1
}
table5 = {
read_units = 100
write_units = 200
storage_gb = 1
}
table6 = {
read_units = 100
write_units = 10
storage_gb = 1
}
table7 = {
read_units = 10
write_units = 10
storage_gb = 1
}
table8 = {
read_units = 3000
write_units = 3000
storage_gb = 50
}
table9 = {
read_units = 4000
write_units = 400
storage_gb = 5
}
table10 = {
read_units = 960
write_units = 860
storage_gb = 2
}
}
How to write a script in terraform that should choose a region-specific map if the value exists for a given region else it should choose the default map (first code snippet).
This means I need a terraform script that will choose a map if the map exists for the current region else It has to choose the default map.
Related
Can't run the spacy spancat (spancategorizer) model?
I am trying to train the spancat model without luck. I am getting: ValueError: [E143] Labels for component 'spancat' not initialized. This can be fixed by calling add_label, or by providing a representative batch of examples to the component's 'initialize' method. I did convert my NER ents to spans: def main(loc: Path, lang: str, span_key: str): """ Set the NER data into the doc.spans, under a given key. The SpanCategorizer component uses the doc.spans, so that it can work with overlapping or nested annotations, which can't be represented on the per-token level. """ nlp = spacy.blank(lang) docbin = DocBin().from_disk(loc) docs = list(docbin.get_docs(nlp.vocab)) for doc in docs: doc.spans[span_key] = list(doc.ents) DocBin(docs=docs).to_disk(loc) Here is my config file: [paths] train = null dev = null vectors = null init_tok2vec = null [system] gpu_allocator = null seed = 444 [nlp] lang = "en" pipeline = ["tok2vec","spancat"] batch_size = 1000 disabled = [] before_creation = null after_creation = null after_pipeline_creation = null tokenizer = {"#tokenizers":"spacy.Tokenizer.v1"} [components] [components.spancat] factory = "spancat" max_positive = null scorer = {"#scorers":"spacy.spancat_scorer.v1"} spans_key = "sc" threshold = 0.5 [components.spancat.model] #architectures = "spacy.SpanCategorizer.v1" [components.spancat.model.reducer] #layers = "spacy.mean_max_reducer.v1" hidden_size = 128 [components.spancat.model.scorer] #layers = "spacy.LinearLogistic.v1" nO = null nI = null [components.spancat.model.tok2vec] #architectures = "spacy.Tok2VecListener.v1" width = ${components.tok2vec.model.encode.width} upstream = "*" [components.spancat.suggester] #misc = "spacy.ngram_suggester.v1" sizes = [1,2,3] [components.tok2vec] factory = "tok2vec" [components.tok2vec.model] #architectures = "spacy.Tok2Vec.v2" [components.tok2vec.model.embed] #architectures = "spacy.MultiHashEmbed.v2" width = ${components.tok2vec.model.encode.width} attrs = ["NORM","PREFIX","SUFFIX","SHAPE"] rows = [5000,1000,2500,2500] include_static_vectors = true [components.tok2vec.model.encode] #architectures = "spacy.MaxoutWindowEncoder.v2" width = 256 depth = 8 window_size = 1 maxout_pieces = 3 [corpora] [corpora.dev] #readers = "spacy.Corpus.v1" path = ${paths.dev} max_length = 0 gold_preproc = false limit = 0 augmenter = null [corpora.train] #readers = "spacy.Corpus.v1" path = ${paths.train} max_length = 0 gold_preproc = false limit = 0 augmenter = null [training] dev_corpus = "corpora.dev" train_corpus = "corpora.train" max_epochs = 70 seed = ${system.seed} gpu_allocator = ${system.gpu_allocator} dropout = 0.1 accumulate_gradient = 1 patience = 1600 max_steps = 20000 eval_frequency = 200 frozen_components = [] annotating_components = [] before_to_disk = null [training.batcher] #batchers = "spacy.batch_by_words.v1" discard_oversize = false tolerance = 0.2 get_length = null [training.batcher.size] #schedules = "compounding.v1" start = 100 stop = 1000 compound = 1.001 t = 0.0 [training.logger] #loggers = "spacy.ConsoleLogger.v1" progress_bar = false [training.optimizer] #optimizers = "Adam.v1" beta1 = 0.9 beta2 = 0.999 L2_is_weight_decay = true L2 = 0.01 grad_clip = 1.0 use_averages = false eps = 0.00000001 learn_rate = 0.001 [training.score_weights] spans_sc_f = 1.0 spans_sc_p = 0.0 spans_sc_r = 0.0 [pretraining] [initialize] vectors = ${paths.vectors} init_tok2vec = ${paths.init_tok2vec} vocab_data = null lookups = null before_init = null after_init = null [initialize.components] [initialize.tokenizer] I am using the "sc" key. Please advise how to solve it.
I have solved it using the following function, but one should address the spans Span(doc, start, end, label) according to the project/text for their task. It worked for me because all the text (a few words in my case) are labeled with a label and this is my need. def convert_to_docbin(input, output_path="./train.spacy", lang='en'): """ Convert a pair of text annotations into DocBin then save """ # Load a new spacy model: nlp = spacy.blank(lang) # Create a DocBin object: db = DocBin() for text, annotations in input: # Data in previous format doc = nlp(text) ents = [] spans = [] for start, end, label in annotations: # Add character indexes spans.append(Span(doc, 0, len(doc), label=label)) span = doc.char_span(start, end, label=label) ents.append(span) doc.ents = ents # Label the text with the ents group = SpanGroup(doc, name="sc", spans=spans) doc.spans["sc"] = group db.add(doc) db.to_disk(output_path)
How to simulate aging effect on back to back inverters in HSPICE
I am trying to simulate the effect of aging in the back-to-back inverters (SRAM PUF). I want to see the starting up of the back-to-back inverter's start-up voltage with transistor aging effect, wherein in one case the output initial from the 2 inverters is 1 0 and in another case, the output case will be 0 1. How to do this in hspice. I know a little about the MOSRA test, but I am not sure how to use that to get the intended aging effect. I have written a back-to-back inverter hspice netlist. but the output is always same with the simulation. How to flip the output with aging simulation. Any help is appreciated. * PUF vdd vdd gnd dc 1v Mp1 out2 out1 vdd vdd pmos w= 90nm l= 45nm Mn1 out2 out gnd gnd nmos w=45nm l= 45nm Mp2 out1 out2 vdd vdd pmos w= 90nm l= 45nm Mn2 out1 out2 gnd gnd nmos w=45nm l= 45nm *transient analysis .model p1_ra mosra level=1 +tit0 = 5e-8 titfd = 7.5e-10 tittd = 1.45e-20 +tn = 0.25 .appendmodel p1_ra mosra p1 pmos .mosra reltotaltime= 1e8 .tran .1ps 5ns .options post .print V(out2) V(out1) * PTM Low Power 45nm Metal Gate / High-K / Strained-Si * nominal Vdd = 1.1V .model nmos nmos level = 54 +version = 4.0 binunit = 1 paramchk= 1 mobmod = 0 +capmod = 2 igcmod = 1 igbmod = 1 geomod = 1 +diomod = 1 rdsmod = 0 rbodymod= 1 rgatemod= 1 +permod = 1 acnqsmod= 0 trnqsmod= 0 +tnom = 27 toxe = 1.8e-009 toxp = 1.5e-009 toxm = 1.8e-009 +dtox = 3e-010 epsrox = 3.9 wint = 5e-009 lint = 0 +ll = 0 wl = 0 lln = 1 wln = 1 +lw = 0 ww = 0 lwn = 1 wwn = 1 +lwl = 0 wwl = 0 xpart = 0 toxref = 1.8e-009 +vth0 = 0.62261 k1 = 0.4 k2 = 0 k3 = 0 +k3b = 0 w0 = 2.5e-006 dvt0 = 1 dvt1 = 2 +dvt2 = 0 dvt0w = 0 dvt1w = 0 dvt2w = 0 +dsub = 0.1 minv = 0.05 voffl = 0 dvtp0 = 1e-010 +dvtp1 = 0.1 lpe0 = 0 lpeb = 0 xj = 1.4e-008 +ngate = 1e+023 ndep = 3.24e+018 nsd = 2e+020 phin = 0 +cdsc = 0 cdscb = 0 cdscd = 0 cit = 0 +voff = -0.13 nfactor = 1.6 eta0 = 0.0125 etab = 0 +vfb = -0.55 u0 = 0.049 ua = 6e-010 ub = 1.2e-018 +uc = 0 vsat = 130000 a0 = 1 ags = 0 +a1 = 0 a2 = 1 b0 = 0 b1 = 0 +keta = 0.04 dwg = 0 dwb = 0 pclm = 0.02 +pdiblc1 = 0.001 pdiblc2 = 0.001 pdiblcb = -0.005 drout = 0.5 +pvag = 1e-020 delta = 0.01 pscbe1 = 8.14e+008 pscbe2 = 1e-007 +fprout = 0.2 pdits = 0.08 pditsd = 0.23 pditsl = 2300000 +rsh = 5 rdsw = 210 rsw = 80 rdw = 80 +rdswmin = 0 rdwmin = 0 rswmin = 0 prwg = 0 +prwb = 0 wr = 1 alpha0 = 0.074 alpha1 = 0.005 +beta0 = 30 agidl = 0.0002 bgidl = 2.1e+009 cgidl = 0.0002 +egidl = 0.8 aigbacc = 0.012 bigbacc = 0.0028 cigbacc = 0.002 +nigbacc = 1 aigbinv = 0.014 bigbinv = 0.004 cigbinv = 0.004 +eigbinv = 1.1 nigbinv = 3 aigc = 0.015211 bigc = 0.0027432 +cigc = 0.002 aigsd = 0.015211 bigsd = 0.0027432 cigsd = 0.002 +nigc = 1 poxedge = 1 pigcd = 1 ntox = 1 +xrcrg1 = 12 xrcrg2 = 5 +cgso = 1.1e-010 cgdo = 1.1e-010 cgbo = 2.56e-011 cgdl = 2.653e-010 +cgsl = 2.653e-010 ckappas = 0.03 ckappad = 0.03 acde = 1 +moin = 15 noff = 0.9 voffcv = 0.02 +kt1 = -0.11 kt1l = 0 kt2 = 0.022 ute = -1.5 +ua1 = 4.31e-009 ub1 = 7.61e-018 uc1 = -5.6e-011 prt = 0 +at = 33000 +fnoimod = 1 tnoimod = 0 +jss = 0.0001 jsws = 1e-011 jswgs = 1e-010 njs = 1 +ijthsfwd= 0.01 ijthsrev= 0.001 bvs = 10 xjbvs = 1 +jsd = 0.0001 jswd = 1e-011 jswgd = 1e-010 njd = 1 +ijthdfwd= 0.01 ijthdrev= 0.001 bvd = 10 xjbvd = 1 +pbs = 1 cjs = 0.0005 mjs = 0.5 pbsws = 1 +cjsws = 5e-010 mjsws = 0.33 pbswgs = 1 cjswgs = 3e-010 +mjswgs = 0.33 pbd = 1 cjd = 0.0005 mjd = 0.5 +pbswd = 1 cjswd = 5e-010 mjswd = 0.33 pbswgd = 1 +cjswgd = 5e-010 mjswgd = 0.33 tpb = 0.005 tcj = 0.001 +tpbsw = 0.005 tcjsw = 0.001 tpbswg = 0.005 tcjswg = 0.001 +xtis = 3 xtid = 3 +dmcg = 0 dmci = 0 dmdg = 0 dmcgt = 0 +dwj = 0 xgw = 0 xgl = 0 +rshg = 0.4 gbmin = 1e-010 rbpb = 5 rbpd = 15 +rbps = 15 rbdb = 15 rbsb = 15 ngcon = 1 .model pmos pmos level = 54 +version = 4.0 binunit = 1 paramchk= 1 mobmod = 0 +capmod = 2 igcmod = 1 igbmod = 1 geomod = 1 +diomod = 1 rdsmod = 0 rbodymod= 1 rgatemod= 1 +permod = 1 acnqsmod= 0 trnqsmod= 0 +tnom = 27 toxe = 1.82e-009 toxp = 1.5e-009 toxm = 1.82e-009 +dtox = 3.2e-010 epsrox = 3.9 wint = 5e-009 lint = 0 +ll = 0 wl = 0 lln = 1 wln = 1 +lw = 0 ww = 0 lwn = 1 wwn = 1 +lwl = 0 wwl = 0 xpart = 0 toxref = 1.82e-009 +vth0 = -0.587 k1 = 0.4 k2 = -0.01 k3 = 0 +k3b = 0 w0 = 2.5e-006 dvt0 = 1 dvt1 = 2 +dvt2 = -0.032 dvt0w = 0 dvt1w = 0 dvt2w = 0 +dsub = 0.1 minv = 0.05 voffl = 0 dvtp0 = 1e-011 +dvtp1 = 0.05 lpe0 = 0 lpeb = 0 xj = 1.4e-008 +ngate = 1e+023 ndep = 2.44e+018 nsd = 2e+020 phin = 0 +cdsc = 0 cdscb = 0 cdscd = 0 cit = 0 +voff = -0.126 nfactor = 1.8 eta0 = 0.0125 etab = 0 +vfb = 0.55 u0 = 0.021 ua = 2e-009 ub = 5e-019 +uc = 0 vsat = 90000 a0 = 1 ags = 1e-020 +a1 = 0 a2 = 1 b0 = 0 b1 = 0 +keta = -0.047 dwg = 0 dwb = 0 pclm = 0.12 +pdiblc1 = 0.001 pdiblc2 = 0.001 pdiblcb = 3.4e-008 drout = 0.56 +pvag = 1e-020 delta = 0.01 pscbe1 = 8.14e+008 pscbe2 = 9.58e-007 +fprout = 0.2 pdits = 0.08 pditsd = 0.23 pditsl = 2300000 +rsh = 5 rdsw = 250 rsw = 75 rdw = 75 +rdswmin = 0 rdwmin = 0 rswmin = 0 prwg = 0 +prwb = 0 wr = 1 alpha0 = 0.074 alpha1 = 0.005 +beta0 = 30 agidl = 0.0002 bgidl = 2.1e+009 cgidl = 0.0002 +egidl = 0.8 aigbacc = 0.012 bigbacc = 0.0028 cigbacc = 0.002 +nigbacc = 1 aigbinv = 0.014 bigbinv = 0.004 cigbinv = 0.004 +eigbinv = 1.1 nigbinv = 3 aigc = 0.0097 bigc = 0.00125 +cigc = 0.0008 aigsd = 0.0097 bigsd = 0.00125 cigsd = 0.0008 +nigc = 1 poxedge = 1 pigcd = 1 ntox = 1 +xrcrg1 = 12 xrcrg2 = 5 +cgso = 1.1e-010 cgdo = 1.1e-010 cgbo = 2.56e-011 cgdl = 2.653e-010 +cgsl = 2.653e-010 ckappas = 0.03 ckappad = 0.03 acde = 1 +moin = 15 noff = 0.9 voffcv = 0.02 +kt1 = -0.11 kt1l = 0 kt2 = 0.022 ute = -1.5 +ua1 = 4.31e-009 ub1 = 7.61e-018 uc1 = -5.6e-011 prt = 0 +at = 33000 +fnoimod = 1 tnoimod = 0 +jss = 0.0001 jsws = 1e-011 jswgs = 1e-010 njs = 1 +ijthsfwd= 0.01 ijthsrev= 0.001 bvs = 10 xjbvs = 1 +jsd = 0.0001 jswd = 1e-011 jswgd = 1e-010 njd = 1 +ijthdfwd= 0.01 ijthdrev= 0.001 bvd = 10 xjbvd = 1 +pbs = 1 cjs = 0.0005 mjs = 0.5 pbsws = 1 +cjsws = 5e-010 mjsws = 0.33 pbswgs = 1 cjswgs = 3e-010 +mjswgs = 0.33 pbd = 1 cjd = 0.0005 mjd = 0.5 +pbswd = 1 cjswd = 5e-010 mjswd = 0.33 pbswgd = 1 +cjswgd = 5e-010 mjswgd = 0.33 tpb = 0.005 tcj = 0.001 +tpbsw = 0.005 tcjsw = 0.001 tpbswg = 0.005 tcjswg = 0.001 +xtis = 3 xtid = 3 +dmcg = 0 dmci = 0 dmdg = 0 dmcgt = 0 +dwj = 0 xgw = 0 xgl = 0 +rshg = 0.4 gbmin = 1e-010 rbpb = 5 rbpd = 15 +rbps = 15 rbdb = 15 rbsb = 15 ngcon = 1 .end
Low of specific period (eg: 20 jan 2015 to 15 nov 2021)
This script draws ATH on chart with date and duration I want to store low of period as well (like high shown in label) to show (high-low) range in the same label. The period does not end today, but as per script. indicator("Previous Year(s) ATH", overlay = true) num_years = input.int(1, title = "Number of years back", minval = 1) var float ATH = high var int ATH_time = time var float[] ATH_vals = array.new_float() var int[] ATH_time_vals = array.new_int() var int[] ATH_time_change_vals = array.new_int() ATH := math.max(ATH, high) if ta.change(ATH) != 0 ATH_time := time array.unshift(ATH_vals, ATH) array.unshift(ATH_time_vals, time) array.unshift(ATH_time_change_vals, ATH_time) var float ATH1Y = na if barstate.isconfirmed search_time = time - 31536000000 * num_years for i = 0 to array.size(ATH_time_vals) - 1 if array.get(ATH_time_vals, i) < search_time ATH1Y := array.get(ATH_vals, i) ATH1Y_time = array.get(ATH_time_change_vals, i) y = year(ATH1Y_time) m = month(ATH1Y_time) d = dayofmonth(ATH1Y_time) days_ago = (time - ATH1Y_time) / 86400000 date_text = str.tostring(y) + "/" + str.tostring(m) + "/" + str.tostring(d) + " : " + str.tostring(ATH1Y) + "\nDays Ago : " + str.tostring(math.round(days_ago, 2)) if ATH > ATH1Y and ATH[3] <= ATH1Y[3] label.new(x = bar_index[3], y = ATH[3], text = date_text, style = label.style_label_lower_right) break ATH_val = ATH > ATH1Y ? na : ATH1Y buy_signal = ATH > ATH1Y and ATH[3] <= ATH1Y[3] plotshape(buy_signal, color = color.green, location = location.belowbar, size = size.small, style = shape.triangleup) plot(ATH_val, title = "ATH", style = plot.style_linebr)
What does the value 0.5 represent here?
This is an implementation of Naive Bayes Classifier Algorithm. I couldn't understand the line score.Add(results[i].Name, finalScore * 0.5);. Where does this value 0.5 come from? Why 0.5? Why not any other value? public string Classify(double[] obj) { Dictionary<string,> score = new Dictionary<string,>(); var results = (from myRow in dataSet.Tables[0].AsEnumerable() group myRow by myRow.Field<string>( dataSet.Tables[0].Columns[0].ColumnName) into g select new { Name = g.Key, Count = g.Count() }).ToList(); for (int i = 0; i < results.Count; i++) { List<double> subScoreList = new List<double>(); int a = 1, b = 1; for (int k = 1; k < dataSet.Tables["Gaussian"].Columns.Count; k = k + 2) { double mean = Convert.ToDouble(dataSet.Tables["Gaussian"].Rows[i][a]); double variance = Convert.ToDouble(dataSet.Tables["Gaussian"].Rows[i][++a]); double result = Helper.NormalDist(obj[b - 1], mean, Helper.SquareRoot(variance)); subScoreList.Add(result); a++; b++; } double finalScore = 0; for (int z = 0; z < subScoreList.Count; z++) { if (finalScore == 0) { finalScore = subScoreList[z]; continue; } finalScore = finalScore * subScoreList[z]; } score.Add(results[i].Name, finalScore * 0.5); } double maxOne = score.Max(c => c.Value); var name = (from c in score where c.Value == maxOne select c.Key).First(); return name; }
I figured it out. 0.5 is the apriori probability.
I have a string that contains a table how to I convert it to a table?
My string is {{{X=-1,Y =-1,Z =1}{X=0,Y =-1,Z =1}{X=1,Y =-1,Z =1}}{{X=-1,Y =0,Z =1}{X=0,Y =0,Z =1}{X=1,Y =0,Z =1}}{{X=-1,Y =1,Z =1}{X=0,Y =1,Z =1}{X=1,Y =1,Z =1}}{{X=-1,Y =2,Z =1}{X=0,Y =2,Z =1}{X=1,Y =2,Z =1}}}{{{X=1,Y =-1,Z=-1}{X=1,Y =-1,Z=0}{X=1,Y =-1,Z=1}}{{X=1,Y =0,Z=-1}{X=1,Y =0,Z=0}{X=1,Y =0,Z=1}}{{X=1,Y =1,Z=-1}{X=1,Y =1,Z=0}{X=1,Y =1,Z=1}}{{X=1,Y =2,Z=-1}{X=1,Y =2,Z=0}{X=1,Y =2,Z=1}}}{{{X=-1,Y =-1,Z = -1}{X=0,Y =-1,Z = -1}{X=1,Y =-1,Z = -1}}{{X=-1,Y =0,Z = -1}{X=0,Y =0,Z = -1}{X=1,Y =0,Z = -1}}{{X=-1,Y =1,Z = -1}{X=0,Y =1,Z = -1}{X=1,Y =1,Z = -1}}{{X=-1,Y =2,Z = -1}{X=0,Y =2,Z = -1}{X=1,Y =2,Z = -1}}}{{{X=-1,Y=-1,Z=-1}{X=-1,Y=-1,Z=0}{X=-1,Y=-1,Z=1}}{{X=-1,Y=0,Z=-1}{X=-1,Y=0,Z=0}{X=-1,Y=0,Z=1}}{{X=-1,Y=1,Z=-1}{X=-1,Y=1,Z=0}{X=-1,Y=1,Z=1}}{{X=-1,Y=2,Z=-1}{X=-1,Y=2,Z=0}{X=-1,Y=2,Z=1}}} I need it to be a table like this { { { X = -1, Y = -1 , Z = 1 } { X = 0, Y = -1 , Z = 1 } { X = 1, Y = -1 , Z = 1 } } { { X = -1, Y = 0 , Z = 1 } { X = 0, Y = 0 , Z = 1 } { X = 1, Y = 0 , Z = 1 } } { { X = -1, Y = 1 , Z = 1 } { X = 0, Y = 1 , Z = 1 } { X = 1, Y = 1 , Z = 1 } } { { X = -1, Y = 2 , Z = 1 } { X = 0, Y = 2 , Z = 1 } { X = 1, Y = 2 , Z = 1 } } } { { { X = 1, Y = -1 , Z = -1 } { X = 1, Y = -1 , Z = 0 } { X = 1, Y = -1 , Z = 1 } } { { X = 1, Y = 0 , Z = -1 } { X = 1, Y = 0 , Z = 0 } { X = 1, Y = 0 , Z = 1 } } { { X = 1, Y = 1 , Z = -1 } { X = 1, Y = 1 , Z = 0 } { X = 1, Y = 1 , Z = 1 } } { { X = 1, Y = 2 , Z = -1 } { X = 1, Y = 2 , Z = 0 } { X = 1, Y = 2 , Z = 1 } } } { { { X = -1, Y = -1 , Z = -1} { X = 0, Y = -1 , Z = -1} { X = 1, Y = -1 , Z = -1} } { { X = -1, Y = 0 , Z = -1} { X = 0, Y = 0 , Z = -1} { X = 1, Y = 0 , Z = -1} } { { X = -1, Y = 1 , Z = -1} { X = 0, Y = 1 , Z = -1} { X = 1, Y = 1 , Z = -1} } { { X = -1, Y = 2 , Z = -1} { X = 0, Y = 2 , Z = -1} { X = 1, Y = 2 , Z = -1} } } { { { X = -1, Y = -1 , Z = -1 } { X = -1, Y = -1 , Z = 0 } { X = -1, Y = -1 , Z = 1 } } { { X = -1, Y = 0 , Z = -1 } { X = -1, Y = 0 , Z = 0 } { X = -1, Y = 0 , Z = 1 } } { { X = -1, Y = 1 , Z = -1 } { X = -1, Y = 1 , Z = 0 } { X = -1, Y = 1 , Z = 1 } } { { X = -1, Y = 2 , Z = -1 } { X = -1, Y = 2 , Z = 0 } { X = -1, Y = 2 , Z = 1 } } } what methods or how would I go about doing this ? I would do it during the table generation (add the tables in tables but the code I have seems to put it in the tables incorrectly. so the code generates a string that contains the correct tables and I need to know how to place that sting of tables into a table ...
Well, you could manually parse it. I won't however, make it FOR you. I will however give you a temporary solution. (It's a pretty bad one, but until you make a parser it's good enough) local tab = load("return "..you_table_string)() Note: In Lua 5.1 and under it's loadstring Which compiles code from a string into a function, doing so is usually frowned upon though.
local Xmin = -1 local Xmax = 1 local Ymin = -1 local Ymax = 2 local Zmin = 1 local Zmax = 1 local BoxControl = 3 tbmroad.offsets = {} local a = 0 local b = 0 local c = 0 local d = 0 local e = {} local f = {} local g = {} local h = {} local i = {} local j = {} local k = {} local offsets = {} local index = 0 for a = 0, BoxControl do for b = Zmin, Zmax do for c = Ymin, Ymax do for d = Xmin, Xmax do if a == 0 then e[d+1] = {X = d, Y = c , Z = b} elseif a == 1 then e[d+1] = { X = b, Y = c , Z = d } elseif a == 2 then b1= b * -1 e[d+1] = { X = d, Y = c , Z = b1} elseif a == 3 then b1 = b * -1 e[d+1] = { X = b1, Y = c , Z = d} end end f[c+1] = e end offsets[#offsets+1] = f end end done and done