Dear Hans,

> You have to be more careful here; you do
> 
>  MP = { }
> 
> which overloaded an official global namespace. That will backfire at some 
> point.
> 
> You still have mtx as global alias without testing if it exists. Don't do 
> that, because one never knows if context itself will use that namespace (ctx, 
> mtx ...).  Basically we don't expect users or modules to define global tables 
> at all, and if they to one has it coming. Just use userdata or moduledata 
> (with subtable) or so.
> 
I didn’t think it seriously.
I changed ‘mix’ to ‘matOP’.

> I'm not going to rewrite your code but here are a few suggestions:
> 
>    function MP.loadmydata(n)
>        MP.mydata = table.load(n)
>    end
> 
>    function MP.getmydata(i,j)
>        mp.print(MP.mydata[i][j])
>    end
> 
> and then
> 
> % lua("MP = { } MP.data = table.load('tempList.lua')") ;
> lua.MP.loadmydata('tempList.lua') ;
> 
> with
> 
> %     yy := lua("mp.print(MP.data[" & decimal i & "][" &  decimal j & "])");
>    yy := lua.MP.getmydata(i,j);
> 
It is easy to understand and  works great!

Thank you so much.

Best regards,

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

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to