+\begingroup
+\endlinechar=13
+\catcode`\_=12
+\gdef\newluatexcatcodetable#1{%
+ \ifnum\lltxb@catcodetable@alloc<\ltj@cctb@limit\relax
+ \global\advance\lltxb@catcodetable@alloc\tw@
+ \allocationnumber\lltxb@catcodetable@alloc
+ \global\chardef#1\allocationnumber
+ \luatexinitcatcodetable\allocationnumber
+ \begingroup\escapechar\m@ne
+ \luatexbase@directlua{luatexbase.catcodetabledef_from_tex(
+ '\luatexluaescapestring{\string#1}', '\number\allocationnumber')}%
+ \endgroup
+ \wlog{\string#1=\string\luatexcatcodetable\the\allocationnumber}%
+ \else
+ \errmessage{No room for a new \string\luatexcatcodetable}%
+ \fi}
+\endgroup
+
+%-------------------
+