-- ext_... : called from \directlua{}
-- int_... : called from other Lua codes, but not from \directlua{}
-- (other) : only called from this file
-
+function luatexja.error(s,t)
+ tex.error('LuaTeX-ja error: ' .. s ,t)
+end
+function luatexja.load_module(name)
+ if not package.loaded['luatexja.' .. name] then
+ local fn = 'ltj-' .. name .. '.lua'
+ local found = kpse.find_file(fn, 'tex')
+ if not found then
+ luatexja.error("File `" .. fn .. "' not found",
+ {'This file ' .. fn .. ' is required for LuaTeX-ja.', 'Please check your installation.'})
+ else
+ texio.write('(' .. found .. ')\n')
+ dofile(found)
+ end
+ end
+end
function luatexja.load_lua(fn)
local found = kpse.find_file(fn, 'tex')
if not found then
error("File `" .. fn .. "' not found")
else
- texio.write('(' .. found .. ')')
- require(found)
+ texio.write('(' .. found .. ')\n')
+ dofile(found)
end
end