On 2/13/2017 6:50 AM, Jeong Dal wrote:
Dear all,

It may be a slight off topic.
In the following example, I copied a table “m” to “tempM”, and remove the last 
row of tempM.
Then the output is “ 2, 2”
I checked the contents of tempM and m and found that they are same even though 
I didn’t touch m.
I want to remove the last row of tempM while keeping the table m untouched.
Please tell me how to do it.

\startbuffer[test]
\startluacode
    local t1 = {{0, 2, 4},{2, 3 , 4}, {2, 2, -6}}
    local t2 = t1 -- t2 points to t1
    local t3 = table.copy(t1)

    table.remove(t3)

    context.tocontext(t1)
    context.tocontext(t2)
    context.tocontext(t3)

\stopluacode
\stopbuffer

\starttext
\getbuffer[test]
\stoptext



Thank you.
Best regards,

Dalyoung

\startbuffer[test]
\startluacode
 m = {{0, 2, 4},{2, 3 , 4}, {2, 2, -6}}
local tempM = {}

tempM = m
table.remove(tempM)
context(#tempM, “, ” , #m)
\stopluacode
\stopbuffer

\starttext
getbuffer[test]
\stoptext



___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________



--

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to