From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/59357 Path: news.gmane.org!not-for-mail From: Jaroslav Hajtmar Newsgroups: gmane.comp.tex.context Subject: Re: Lua in LuaLaTeX is diferent?? Date: Sun, 06 Jun 2010 08:34:28 +0200 Message-ID: <4C0B4174.7040909@gyza.cz> References: <4C0AB151.4060808@gyza.cz> <4C0ADF3B.9030308@gyza.cz> <20100606024619.GA2630@khaled-laptop> <4C0B3CFB.7040800@gyza.cz> Reply-To: hajtmar@gyza.cz, mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1275806085 21514 80.91.229.12 (6 Jun 2010 06:34:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Jun 2010 06:34:45 +0000 (UTC) Cc: mailing list for ConTeXt users To: hajtmar@gyza.cz Original-X-From: ntg-context-bounces@ntg.nl Sun Jun 06 08:34:44 2010 connect(): No such file or directory Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OL9RR-0003Xn-VR for gctc-ntg-context-518@m.gmane.org; Sun, 06 Jun 2010 08:34:42 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7953AC9CB4; Sun, 6 Jun 2010 08:34:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5sbC88Zq7Kik; Sun, 6 Jun 2010 08:34:36 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id F2285C9C35; Sun, 6 Jun 2010 08:34:35 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9522DC9C35 for ; Sun, 6 Jun 2010 08:34:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id oOLcdTafuApK for ; Sun, 6 Jun 2010 08:34:32 +0200 (CEST) Original-Received: from psi3.forpsi.com (smtpa.forpsi.com [81.2.195.204]) by balder.ntg.nl (Postfix) with SMTP id DAACDC9C33 for ; Sun, 6 Jun 2010 08:34:31 +0200 (CEST) Original-Received: (qmail 30193 invoked by uid 89); 6 Jun 2010 06:34:30 -0000 Original-Received: from unknown (HELO ?192.168.1.3?) (hajtmar@gyza.cz@88.103.230.14) by psi03 with ESMTPA; 6 Jun 2010 06:34:30 -0000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; cs; rv:1.9.1.8) Gecko/20100216 Thunderbird/3.0.2 In-Reply-To: <4C0B3CFB.7040800@gyza.cz> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:59357 Archived-At: 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 >>> ___________________________________________________________________________________ >>> > ___________________________________________________________________________________ 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 ___________________________________________________________________________________