View Issue Details

IDProjectCategoryView StatusLast Update
0000682luatexfeature requestpublic2018-02-25 17:09
ReporterTacoAssigned ToHans Hagen 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionno change required 
Product Version 
Target Versionmaybe never (> v 1)Fixed in Version1.10.0 
Summary0000682: Create tex.execute()
DescriptionSyntax as for tex.print(), but executed immediately, and including a potential errors when used in a non-expandable context.

This is mostly *needed* because coroutines will be different and less powerful in lua 5.2, but besides that it would also be very useful, in all sorts of cases.
Steps To Reproduceit will probably be a mess and still not always ok ... one can do this already:

\directlua {

tex.directprinter = nil

function tex.directprint(...)
    tex.print(...)
    tex.print("\\directlua{coroutine.resume(tex.directprinter)}")
    coroutine.yield()
end

function tex.directsprint(...)
    tex.sprint(...)
    tex.sprint("\\directlua{coroutine.resume(tex.directprinter)}")
    coroutine.yield()
end

function stepwise(f)
    tex.directprinter = coroutine.create(f)
    coroutine.resume(tex.directprinter)
end

}

test

\directlua {
    stepwise (function()
        tex.directprint("\\setbox0\\hbox{!!!!}")
        tex.directprint(tex.getbox(0).width .. "\\par")
        tex.directprint("\\setbox2\\hbox{????}")
        tex.directprint(tex.getbox(2).width .. "\\par")
        tex.directprint("\\copy0\\copy2\par")
        stepwise (function()
            tex.directprint("\\bgroup")
            tex.directprint("\\setbox0\\hbox{>>>>}")
            tex.directprint(tex.getbox(0).width .. "\\par")
            tex.directprint("\\setbox2\\hbox{<<<<}")
            tex.directprint(tex.getbox(2).width .. "\\par")
            tex.directprint("\\copy0\\copy2\par")
            tex.directprint("\\copy0\\copy2\par")
            tex.directprint("\\egroup")
        end)
        tex.directprint("\\copy0\\copy2\par")
    end)
}

test
TagsNo tags attached.

Activities

oneiros

2012-01-15 23:34

developer   ~0000919

See also the discussion at http://tex.stackexchange.com/q/20893/5763

Hans Hagen

2018-02-25 17:09

manager   ~0001686

too complex without pproper managemt of the run (interferences) but already possible by tail calls back into lua apart from potential nesting levels overflow; made a bit more convenient with extra helper that quits input (discussed /presented at upcoming ctx meeting)

Issue History

Date Modified Username Field Change
2011-06-16 16:16 Taco New Issue
2012-01-15 23:34 oneiros Note Added: 0000919
2012-08-10 15:45 oneiros Severity minor => feature
2015-11-08 16:45 Hans Hagen Product Version => maybe never (> v 1)
2015-11-08 16:45 Hans Hagen Steps to Reproduce Updated View Revisions
2015-11-08 16:45 Hans Hagen Status new => acknowledged
2015-11-08 16:46 Hans Hagen Status acknowledged => assigned
2015-11-11 11:52 Hans Hagen Product Version maybe never (> v 1) =>
2015-11-11 11:52 Hans Hagen Target Version => maybe never (> v 1)
2018-01-25 16:32 Hans Hagen Assigned To => Hans Hagen
2018-02-25 17:09 Hans Hagen Note Added: 0001686
2018-02-25 17:09 Hans Hagen Status assigned => closed
2018-02-25 17:09 Hans Hagen Resolution open => no change required
2018-02-25 17:09 Hans Hagen Fixed in Version => 1.10.0