[NTG-context] Merging two lua tables

Hans Hagen j.hagen at xs4all.nl
Mon Aug 29 16:28:17 CEST 2022


On 8/29/2022 2:20 PM, Aditya Mahajan via ntg-context wrote:
> Hi,
> 
> How do I merge two lua tables? I believe that table.merge or table.merged should do the trick, but I cannot figure out how to use them.
> 
> ```
> local t1 = { 1, 2 }
> local t2 = { 8, 9 }
> 
> local m1 = {}
> table.merge(m1,t1, t2)
> table.print(m1)
> 
> local m2 = table.merged(t1, t2)
> table.print(m2)
> ```
> 
> Processing the file with context filename shows that both m1 and m2 are {8, 9}. What am I missing.
table.imerge(m1,t1, t2)

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list