From: Khaled Hosny <khaledhosny@eglug.org>
To: Jaroslav Hajtmar <hajtmar@gyza.cz>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Lua in LuaLaTeX is diferent??
Date: Sun, 6 Jun 2010 16:00:37 +0300 [thread overview]
Message-ID: <20100606130036.GA2978@khaled-laptop> (raw)
In-Reply-To: <4C0B3CFB.7040800@gyza.cz>
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):
> >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
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2010-06-06 13:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-05 20:19 Jaroslav Hajtmar
2010-06-05 23:35 ` Jaroslav Hajtmar
2010-06-06 2:46 ` Khaled Hosny
2010-06-06 6:15 ` Jaroslav Hajtmar
2010-06-06 6:34 ` Jaroslav Hajtmar
2010-06-06 11:17 ` Hans Hagen
2010-06-06 13:00 ` Khaled Hosny [this message]
2010-06-06 11:42 ` Hans Hagen
2010-06-06 11:13 ` Hans Hagen
2010-06-06 18:24 ` Jaroslav Hajtmar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100606130036.GA2978@khaled-laptop \
--to=khaledhosny@eglug.org \
--cc=hajtmar@gyza.cz \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).