From 6fe5baf09d0222b4e3546e29fd6897f857483755 Mon Sep 17 00:00:00 2001
From: Frank Fuhlbrück
Date: Sat, 22 Jan 2022 16:29:41 +0100
Subject: started Lua interface

---
 exercisesheets-beamer.sty | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

(limited to 'exercisesheets-beamer.sty')

diff --git a/exercisesheets-beamer.sty b/exercisesheets-beamer.sty
index fe40937..6688624 100644
--- a/exercisesheets-beamer.sty
+++ b/exercisesheets-beamer.sty
@@ -1349,3 +1349,48 @@
   \end{beamercolorbox}}%
   \vskip0pt%
 }
+
+
+\ifluatex
+\usepackage{luacode}
+\begingroup
+\catcode`!=0
+\catcode`\@=11
+\catcode`\_=12
+\catcode`\{=12 %set those to the same value (11/12) as below! 
+\catcode`\}=12 %
+\catcode`<=1
+\catcode`>=2
+\catcode`\~=11
+\catcode`\\=11
+%% Exoanded, when \catcode`\^^M=12 holds
+!global!long!def!@start@Lexercise@Helper#1\end{Lexercise}< %
+  !directlua<exsh_cur_exercise=exercise ({#1})> %
+  !endgroup!end<Lexercise>!par %
+>
+!endgroup
+\def\startLexercise{
+\begingroup
+\catcode`!=12
+\catcode`\$=12
+\catcode`\#=12
+\catcode`\_=12
+\catcode`\^=12
+\catcode`\&=12
+\catcode`\|=12
+\catcode`\{=12 %set those to the same value (11/12) as above! 
+\catcode`\}=12 %
+\catcode`\~=12
+\catcode`\@=11
+\catcode`\%=12
+\catcode`\^^I=12
+\catcode`\^^J=12\catcode`\^^M=12\catcode`\\=11\endlinechar-1\@start@Lexercise@Helper}
+
+\newenvironment{Lexercise}{%
+  \startLexercise%
+}{%
+  \directlua{tex.print(exsh_cur_exercise)}
+}
+
+\directlua{dofile("lexercise.lua")}
+\fi
-- 
cgit v1.2.3

