Lua in LuaLaTeX is diferent??
Hi, I did a Lua application for ConTeXt, and now I wanted to adapt it to work even LuaLaTeX. On what needs to be careful? Compiling by LuaLaTeX specific messages appear as if the Lua in LuaLaTeX didnt know some Lua commands (i.e. split, find .... ). On what needs to be careful generaly when programming applications for LuaLaTeX? Thanx Jaroslav
Hi, I am sending examples of functions: The first function is functional in ConTeXt MKIV even LuaLaTeX. -- Global variables for setup in library (it be used when glob. vars Sep, Ld, Rd is not setting in main aplication): UserCSVSeparator=';' UserCSVLeftDelimiter='' UserCSVRightDelimiter='' function ParseCSVdata(s) local Sep = (Sep == nil) and UserCSVSeparator or Sep local Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld local Rd = (Rd == nil) and UserCSVRightDelimiter or Rd if Ld ~= '' or Rd ~= '' then local s=string.sub(s, string.find(s, Ld)+1, string.find(s, Rd,-1)-1) end local fieldsep=tostring(Rd..Sep..Ld) local result = {} local from = 1 local sep_from, sep_to = string.find( s, fieldsep, from ) while sep_from do table.insert( result, string.sub( s, from , sep_from-1 ) ) from = sep_to + 1 sep_from, sep_to = string.find( s, fieldsep, from ) end table.insert( result, string.sub( s, from ) ) return result end The second is more universal, but it only works in ConTeXt MKIV. LuaLaTeX report error: "attempt to call field 'split' (a nil value) ... ." function ParseCSVdata(string2parse, separator, leftdelimiter, rightdelimiter) Sep = (Sep == nil) and UserCSVSeparator or Sep Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld Rd = (Rd == nil) and UserCSVRightDelimiter or Rd local separator = (separator == nil) and Sep or separator local leftdelimiter = (leftdelimiter == nil) and Ld or leftdelimiter local rightdelimiter = (rightdelimiter == nil) and Rd or rightdelimiter local result={} if leftdelimiter ~= '' and rightdelimiter ~= '' then string.gsub(string2parse, leftdelimiter.."(.-)"..rightdelimiter, function(a) table.insert(result,a) end ) else result=string.split(string2parse,separator) end return result end I would like to benefit from the second function, but I want the application was applicable even LuaLaTeX Thanx Jaroslav Dne 5.6.2010 22:19, Jaroslav Hajtmar napsal(a):
Hi, I did a Lua application for ConTeXt, and now I wanted to adapt it to work even LuaLaTeX. On what needs to be careful? Compiling by LuaLaTeX specific messages appear as if the Lua in LuaLaTeX didnt know some Lua commands (i.e. split, find .... ).
On what needs to be careful generaly when programming applications for LuaLaTeX?
Thanx Jaroslav ___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On Sun, Jun 06, 2010 at 01:35:23AM +0200, Jaroslav Hajtmar wrote:
Hi,
I am sending examples of functions:
The first function is functional in ConTeXt MKIV even LuaLaTeX.
-- Global variables for setup in library (it be used when glob. vars Sep, Ld, Rd is not setting in main aplication): UserCSVSeparator=';' UserCSVLeftDelimiter='' UserCSVRightDelimiter=''
function ParseCSVdata(s) local Sep = (Sep == nil) and UserCSVSeparator or Sep local Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld local Rd = (Rd == nil) and UserCSVRightDelimiter or Rd if Ld ~= '' or Rd ~= '' then local s=string.sub(s, string.find(s, Ld)+1, string.find(s, Rd,-1)-1) end local fieldsep=tostring(Rd..Sep..Ld) local result = {} local from = 1 local sep_from, sep_to = string.find( s, fieldsep, from ) while sep_from do table.insert( result, string.sub( s, from , sep_from-1 ) ) from = sep_to + 1 sep_from, sep_to = string.find( s, fieldsep, from ) end table.insert( result, string.sub( s, from ) ) return result end
The second is more universal, but it only works in ConTeXt MKIV. LuaLaTeX report error: "attempt to call field 'split' (a nil value) ... ."
function ParseCSVdata(string2parse, separator, leftdelimiter, rightdelimiter) Sep = (Sep == nil) and UserCSVSeparator or Sep Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld Rd = (Rd == nil) and UserCSVRightDelimiter or Rd local separator = (separator == nil) and Sep or separator local leftdelimiter = (leftdelimiter == nil) and Ld or leftdelimiter local rightdelimiter = (rightdelimiter == nil) and Rd or rightdelimiter local result={} if leftdelimiter ~= '' and rightdelimiter ~= '' then string.gsub(string2parse, leftdelimiter.."(.-)"..rightdelimiter, function(a) table.insert(result,a) end ) else result=string.split(string2parse,separator) end return result end
I would like to benefit from the second function, but I want the application was applicable even LuaLaTeX
You need the lualibs package, which imports some of the extended lua librarires from ConTeXt, since string.split() is not a standad lua function. Regards, Khaled
Thanx Jaroslav
Dne 5.6.2010 22:19, Jaroslav Hajtmar napsal(a):
Hi, I did a Lua application for ConTeXt, and now I wanted to adapt it to work even LuaLaTeX. On what needs to be careful? Compiling by LuaLaTeX specific messages appear as if the Lua in LuaLaTeX didnt know some Lua commands (i.e. split, find .... ).
On what needs to be careful generaly when programming applications for LuaLaTeX?
Thanx Jaroslav ___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
Thanks very much. It is very unpleasant findings, but, it explains everything. Can be detected using Lua whether application runs under LuaLaTeX or LuaPlain and then load the library? How can I retrieve LuaLib? Where can I get more information? I did some Googling but without success. Thanx Jaroslav Dne 6.6.2010 4:46, Khaled Hosny napsal(a):
On Sun, Jun 06, 2010 at 01:35:23AM +0200, Jaroslav Hajtmar wrote:
Hi,
I am sending examples of functions:
The first function is functional in ConTeXt MKIV even LuaLaTeX.
-- Global variables for setup in library (it be used when glob. vars Sep, Ld, Rd is not setting in main aplication): UserCSVSeparator=';' UserCSVLeftDelimiter='' UserCSVRightDelimiter=''
function ParseCSVdata(s) local Sep = (Sep == nil) and UserCSVSeparator or Sep local Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld local Rd = (Rd == nil) and UserCSVRightDelimiter or Rd if Ld ~= '' or Rd ~= '' then local s=string.sub(s, string.find(s, Ld)+1, string.find(s, Rd,-1)-1) end local fieldsep=tostring(Rd..Sep..Ld) local result = {} local from = 1 local sep_from, sep_to = string.find( s, fieldsep, from ) while sep_from do table.insert( result, string.sub( s, from , sep_from-1 ) ) from = sep_to + 1 sep_from, sep_to = string.find( s, fieldsep, from ) end table.insert( result, string.sub( s, from ) ) return result end
The second is more universal, but it only works in ConTeXt MKIV. LuaLaTeX report error: "attempt to call field 'split' (a nil value) ... ."
function ParseCSVdata(string2parse, separator, leftdelimiter, rightdelimiter) Sep = (Sep == nil) and UserCSVSeparator or Sep Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld Rd = (Rd == nil) and UserCSVRightDelimiter or Rd local separator = (separator == nil) and Sep or separator local leftdelimiter = (leftdelimiter == nil) and Ld or leftdelimiter local rightdelimiter = (rightdelimiter == nil) and Rd or rightdelimiter local result={} if leftdelimiter ~= '' and rightdelimiter ~= '' then string.gsub(string2parse, leftdelimiter.."(.-)"..rightdelimiter, function(a) table.insert(result,a) end ) else result=string.split(string2parse,separator) end return result end
I would like to benefit from the second function, but I want the application was applicable even LuaLaTeX
You need the lualibs package, which imports some of the extended lua librarires from ConTeXt, since string.split() is not a standad lua function.
Regards, Khaled
Thanx Jaroslav
Dne 5.6.2010 22:19, Jaroslav Hajtmar napsal(a):
Hi, I did a Lua application for ConTeXt, and now I wanted to adapt it to work even LuaLaTeX. On what needs to be careful? Compiling by LuaLaTeX specific messages appear as if the Lua in LuaLaTeX didnt know some Lua commands (i.e. split, find .... ).
On what needs to be careful generaly when programming applications for LuaLaTeX?
Thanx Jaroslav ___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Thanks very much. It is very unpleasant findings, but, it explains everything. Can be detected using Lua whether application runs under LuaLaTeX or LuaPlain and then load the library? How can I retrieve LuaLib? Where can I get more information? I did some Googling but without success. Thanx Jaroslav
Dne 6.6.2010 4:46, Khaled Hosny napsal(a):
Hi,
I am sending examples of functions:
The first function is functional in ConTeXt MKIV even LuaLaTeX.
-- Global variables for setup in library (it be used when glob. vars Sep, Ld, Rd is not setting in main aplication): UserCSVSeparator=';' UserCSVLeftDelimiter='' UserCSVRightDelimiter=''
function ParseCSVdata(s) local Sep = (Sep == nil) and UserCSVSeparator or Sep local Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld local Rd = (Rd == nil) and UserCSVRightDelimiter or Rd if Ld ~= '' or Rd ~= '' then local s=string.sub(s, string.find(s, Ld)+1, string.find(s, Rd,-1)-1) end local fieldsep=tostring(Rd..Sep..Ld) local result = {} local from = 1 local sep_from, sep_to = string.find( s, fieldsep, from ) while sep_from do table.insert( result, string.sub( s, from , sep_from-1 ) ) from = sep_to + 1 sep_from, sep_to = string.find( s, fieldsep, from ) end table.insert( result, string.sub( s, from ) ) return result end
The second is more universal, but it only works in ConTeXt MKIV. LuaLaTeX report error: "attempt to call field 'split' (a nil value) ... ."
function ParseCSVdata(string2parse, separator, leftdelimiter, rightdelimiter) Sep = (Sep == nil) and UserCSVSeparator or Sep Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld Rd = (Rd == nil) and UserCSVRightDelimiter or Rd local separator = (separator == nil) and Sep or separator local leftdelimiter = (leftdelimiter == nil) and Ld or leftdelimiter local rightdelimiter = (rightdelimiter == nil) and Rd or rightdelimiter local result={} if leftdelimiter ~= '' and rightdelimiter ~= '' then string.gsub(string2parse, leftdelimiter.."(.-)"..rightdelimiter, function(a) table.insert(result,a) end ) else result=string.split(string2parse,separator) end return result end
I would like to benefit from the second function, but I want the application was applicable even LuaLaTeX You need the lualibs package, which imports some of the extended lua
On Sun, Jun 06, 2010 at 01:35:23AM +0200, Jaroslav Hajtmar wrote: librarires from ConTeXt, since string.split() is not a standad lua function.
Regards, Khaled
Thanx Jaroslav
Dne 5.6.2010 22:19, Jaroslav Hajtmar napsal(a):
Hi, I did a Lua application for ConTeXt, and now I wanted to adapt it to work even LuaLaTeX. On what needs to be careful? Compiling by LuaLaTeX specific messages appear as if the Lua in LuaLaTeX didnt know some Lua commands (i.e. split, find .... ).
On what needs to be careful generaly when programming applications for LuaLaTeX?
Thanx Jaroslav ___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 6-6-2010 8:34, Jaroslav Hajtmar wrote:
Thanks very much. It is very unpleasant findings, but, it explains everything. Can be detected using Lua whether application runs under LuaLaTeX or LuaPlain and then load the library?
something if not context then require "l-string" end (I will provide another way too.) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Lualibs is available on CTAN, it is a repackages l-*.lua ConTeXt modules. On Sun, Jun 06, 2010 at 08:15:23AM +0200, Jaroslav Hajtmar wrote:
Thanks very much. It is very unpleasant findings, but, it explains everything. Can be detected using Lua whether application runs under LuaLaTeX or LuaPlain and then load the library? How can I retrieve LuaLib? Where can I get more information? I did some Googling but without success. Thanx Jaroslav
Dne 6.6.2010 4:46, Khaled Hosny napsal(a):
Hi,
I am sending examples of functions:
The first function is functional in ConTeXt MKIV even LuaLaTeX.
-- Global variables for setup in library (it be used when glob. vars Sep, Ld, Rd is not setting in main aplication): UserCSVSeparator=';' UserCSVLeftDelimiter='' UserCSVRightDelimiter=''
function ParseCSVdata(s) local Sep = (Sep == nil) and UserCSVSeparator or Sep local Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld local Rd = (Rd == nil) and UserCSVRightDelimiter or Rd if Ld ~= '' or Rd ~= '' then local s=string.sub(s, string.find(s, Ld)+1, string.find(s, Rd,-1)-1) end local fieldsep=tostring(Rd..Sep..Ld) local result = {} local from = 1 local sep_from, sep_to = string.find( s, fieldsep, from ) while sep_from do table.insert( result, string.sub( s, from , sep_from-1 ) ) from = sep_to + 1 sep_from, sep_to = string.find( s, fieldsep, from ) end table.insert( result, string.sub( s, from ) ) return result end
The second is more universal, but it only works in ConTeXt MKIV. LuaLaTeX report error: "attempt to call field 'split' (a nil value) ... ."
function ParseCSVdata(string2parse, separator, leftdelimiter, rightdelimiter) Sep = (Sep == nil) and UserCSVSeparator or Sep Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld Rd = (Rd == nil) and UserCSVRightDelimiter or Rd local separator = (separator == nil) and Sep or separator local leftdelimiter = (leftdelimiter == nil) and Ld or leftdelimiter local rightdelimiter = (rightdelimiter == nil) and Rd or rightdelimiter local result={} if leftdelimiter ~= '' and rightdelimiter ~= '' then string.gsub(string2parse, leftdelimiter.."(.-)"..rightdelimiter, function(a) table.insert(result,a) end ) else result=string.split(string2parse,separator) end return result end
I would like to benefit from the second function, but I want the application was applicable even LuaLaTeX You need the lualibs package, which imports some of the extended lua
On Sun, Jun 06, 2010 at 01:35:23AM +0200, Jaroslav Hajtmar wrote: librarires from ConTeXt, since string.split() is not a standad lua function.
Regards, Khaled
Thanx Jaroslav
Dne 5.6.2010 22:19, Jaroslav Hajtmar napsal(a):
Hi, I did a Lua application for ConTeXt, and now I wanted to adapt it to work even LuaLaTeX. On what needs to be careful? Compiling by LuaLaTeX specific messages appear as if the Lua in LuaLaTeX didnt know some Lua commands (i.e. split, find .... ).
On what needs to be careful generaly when programming applications for LuaLaTeX?
Thanx Jaroslav ___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
On 6-6-2010 1:35, Jaroslav Hajtmar wrote:
The second is more universal, but it only works in ConTeXt MKIV. LuaLaTeX report error: "attempt to call field 'split' (a nil value) ... ."
function ParseCSVdata(string2parse, separator, leftdelimiter, rightdelimiter) Sep = (Sep == nil) and UserCSVSeparator or Sep Ld = (Ld == nil) and UserCSVLeftDelimiter or Ld Rd = (Rd == nil) and UserCSVRightDelimiter or Rd local separator = (separator == nil) and Sep or separator local leftdelimiter = (leftdelimiter == nil) and Ld or leftdelimiter local rightdelimiter = (rightdelimiter == nil) and Rd or rightdelimiter local result={} if leftdelimiter ~= '' and rightdelimiter ~= '' then string.gsub(string2parse, leftdelimiter.."(.-)"..rightdelimiter, function(a) table.insert(result,a) end ) else result=string.split(string2parse,separator) end return result end
You probably mean something ... UserCSVSeparator = ';' UserCSVLeftDelimiter = '' UserCSVRightDelimiter = '' function ParseCSVdata(string2parse, separator, leftdelimiter, rightdelimiter) leftdelimiter = leftdelimiter or Ld or UserCSVLeftDelimiter or "" rightdelimiter = rightdelimiter or Rd or UserCSVRightDelimiter or "" if leftdelimiter ~= '' and rightdelimiter ~= '' then local result = { } local pattern = string.esc(leftdelimiter) .. "(.-)" .. string.esc(rightdelimiter) for s in string.gmatch(string2parse,pattern) do table.insert(result,s) end return result else return string.split(string2parse,separator or Sep or UserCSVSeparator or ";") end end but anyhow, this might (name) clash at some point i guess, for instance because of using globals like Ld In order to be more or less compatible with the context module and third party code setup, in context you need to do: thirddata = thirddata or { } thirddata.cvs = { separator = ';', leftdelimiter = '', rightdelimiter = '', } function thirddata.cvs.parse(string2parse,separator,leftdelimiter,rightdelimiter) leftdelimiter = leftdelimiter or thirddata.leftdelimiter or "" rightdelimiter = rightdelimiter or thirddata.rightdelimiter or "" if leftdelimiter ~= "" and rightdelimiter ~= "" then local result = { } local pattern = string.esc(leftdelimiter) .. "(.-)" .. string.esc(rightdelimiter) for s in string.gmatch(string2parse,pattern) do table.insert(result,s) end return result else return string.split(string2parse,separator or thirddata.separator or ";") end end -- print(table.serialize(thirddata.cvs.parse("11,ss,cc",","))) -- print(table.serialize(thirddata.cvs.parse("[11] [ss] [cc]","","[","]"))) but i have no clue how this is used so there might be better approaches Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 5-6-2010 10:19, Jaroslav Hajtmar wrote:
Hi, I did a Lua application for ConTeXt, and now I wanted to adapt it to work even LuaLaTeX. On what needs to be careful? Compiling by LuaLaTeX specific messages appear as if the Lua in LuaLaTeX didnt know some Lua commands (i.e. split, find .... ).
On what needs to be careful generaly when programming applications for LuaLaTeX?
In context there is quite some lua code that can be used by users for their applications. The l-*.lua files can considered to be more general libraries and most ofthat is unlikely to change (extended for sure). At some point I will make a manual for that. Of course you can always load such modules using 'require'. Using other context lua code outside context is more tricky as it also assumes the system to be designed in a certain way. I hope to have much if that stable within the next few years. As long as one does not mess with the namespaces not much harm can be done. I'm not following lualatex dev but i know that it uses some of the font code. The reason that this code can be shared is that it's sort of isolated and specific functionality needed is wrapped up in *-dum.lua modules. Probbably some stripping down will happen to prevent clashes etc. Here the reference is luatex-plain.tex (and luatex-fonts.tex) in the context distribution. Also, the reverse is also tricky: lualatex speicific code is unlikely to work in context. BTW, Sharing macro code between context and latex is non trivial either as both are different systems and developed completely independent. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hi, Hans Thanks a lot for advice and inspiration. With your contribution of my applications running under LuaPlain well below LuaLaTeX :-). Application process CSV tables and allows you to easily print the data in CSV tables (mailmerges, cards, etc). Now I do not know whether somebody else will be interested in my application. ConTeXt uses the few people around me. Therefore, I try to modify it to LuaTeXu and LuaPlain. I think I'm just a lousy programmer, and therefore do not anticipate that the application could become a larger library, you could use others. Thanks again for your time and valuable advice Have a nice day Jaroslav Dne 6.6.2010 13:13, Hans Hagen napsal(a):
On 5-6-2010 10:19, Jaroslav Hajtmar wrote:
Hi, I did a Lua application for ConTeXt, and now I wanted to adapt it to work even LuaLaTeX. On what needs to be careful? Compiling by LuaLaTeX specific messages appear as if the Lua in LuaLaTeX didnt know some Lua commands (i.e. split, find .... ).
On what needs to be careful generaly when programming applications for LuaLaTeX?
In context there is quite some lua code that can be used by users for their applications. The l-*.lua files can considered to be more general libraries and most ofthat is unlikely to change (extended for sure). At some point I will make a manual for that. Of course you can always load such modules using 'require'.
Using other context lua code outside context is more tricky as it also assumes the system to be designed in a certain way. I hope to have much if that stable within the next few years. As long as one does not mess with the namespaces not much harm can be done.
I'm not following lualatex dev but i know that it uses some of the font code. The reason that this code can be shared is that it's sort of isolated and specific functionality needed is wrapped up in *-dum.lua modules. Probbably some stripping down will happen to prevent clashes etc. Here the reference is luatex-plain.tex (and luatex-fonts.tex) in the context distribution.
Also, the reverse is also tricky: lualatex speicific code is unlikely to work in context.
BTW, Sharing macro code between context and latex is non trivial either as both are different systems and developed completely independent.
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Jaroslav Hajtmar
-
Khaled Hosny