Dear All,

I need to fill a lua table with data, and some values may be tables.
How to supply that data from ConTeXt?
The most straightforward way is to make user fill a string with lua code 
of table initiaiser and then use "loadstring".
In this case the syntax is laconic, but resilence in case of errors is zero.
The other way is to have the user to call series of functions, building 
the complex structure from ground up by making basic stuctures and adding 
them to final structure one by one. In this case the passed parameters can 
be scrutinized for correctness, but multiple calls like "addsmthtosmth", 
"setsmthinsmth" will make the result uneasy to read, to say nothing of 
writing.

What is considered kosher in ConTeXt?
Where can I found examples?

        Sincerely, Michail
PS. data that has to be passed to function will look like (example is not lua):
--------------
name = "3D surface";
toolbar = TRUE;         // display 3D toolbar
tree = TRUE;            // display model tree
views = (
         {
         name = "DefaultView";           // first view (default)
         projection = {
                 perspective  = TRUE;    // Perspective projection
                 aac = 2.5;              // View angle
         };
         camera = {                      // Camera position, see movie15 manual 
for explaination
                 coo = [ 0, 0, 0 ];      // Center of orbit - where the camera 
are pointed to
                 c2c = [ 0, 0, 1 ];      // vector from coo directed to camera
                 rot = [40, 0,60 ];      // rotatations of vector from coo 
directed to camera around Ox, Oy, Oz
                 roo = 50;               // distance from coo to camera
                 roll = 0;               // camera rotation angle
         };
         bg = [ 1.0, 1.0, 1.0 ];         // Background color
         lights = "CAD";                 // Lighting scheme
         nodes = ( ( "xlabel", 1.0, TRUE ), ( "ylabel", 1.0, TRUE ), ("Small 
box", 1.0, TRUE) );
         },
         {
         name = "CrossView";             // view with a crossection
         projection = {
                 perspective  = TRUE;    // Perspective projection
                 aac = 2.5;              // View angle
         };
         camera = {                      // Camera position, see movie15 manual 
for explaination
                 coo = [ 0, 0, 0 ];      // Center of orbit - where the camera 
are pointed to
                 c2c = [-1,-1, 0 ];      // vector from coo directed to camera
                 roo = 50;               // distance from coo to camera
                 roll = 0;               // camera rotation angle
         crossection = {
                 point  = [  0,  0,  0 ];
                 normal = [ -1, -1, -1 ];
                 intersection = TRUE;
                 transparent  = FALSE;
         };
         bg = [ 1.0, 1.0, 1.0 ];         // Background color
         lights = "CAD";                 // Lighting scheme
         nodes = ( ( "xlabel", 1.0, TRUE ), ( "ylabel", 1.0, TRUE ), ("Small 
box", 1.0, TRUE) );
         }
}
--------------

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to