Skip to content

Commit 286f7bb

Browse files
committed
Deprecate luabins library
Keep the library available in Lua for now, but show a warning when scripts try to import it. Luabins is a vendored dependency in Aegisub and is no longer maintained upstream. It is not directly used anywhere by Aegisub itself; it was only added as a convenience library for automation scripts, especially for serializing tables to save as line extradata. However, I am not aware of any automation script that actually uses it. (Scripts that do need to serialize data to extradata use the json library for this.) So, at the moment luabins causes some headaches in the build process for what seems to be no gain at all, which is why it is now being deprecated. If no users complain about desperately needing luabins for their script for the next release cycle, luabins will be removed entirely afterwards. Fixes #382.
1 parent 1f0fcf9 commit 286f7bb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

libaegisub/lua/modules.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ extern "C" int luaopen_lpeg(lua_State *L);
2828
namespace agi::lua {
2929
int regex_init(lua_State *L);
3030

31+
int wrap_luaopen_luabins(lua_State *L) {
32+
lua_getfield(L, LUA_GLOBALSINDEX, "aegisub");
33+
lua_getfield(L, -1, "__raise_warning");
34+
lua_remove(L, -2);
35+
36+
push_value(L, "This automation script uses the library luabins. This library is deprecated and will be removed in a future version of Aegisub. If your script critically depends on luabins and cannot be adapted to work without it, please let us know at https://github.com/TypesettingTools/Aegisub/issues/382 .");
37+
lua_call(L, 1, 0);
38+
39+
return luaopen_luabins(L);
40+
}
41+
3142
void preload_modules(lua_State *L) {
3243
luaL_openlibs(L);
3344

@@ -38,7 +49,7 @@ void preload_modules(lua_State *L) {
3849
set_field(L, "aegisub.__unicode_impl", luaopen_unicode_impl);
3950
set_field(L, "aegisub.__lfs_impl", luaopen_lfs_impl);
4051
set_field(L, "lpeg", luaopen_lpeg);
41-
set_field(L, "luabins", luaopen_luabins);
52+
set_field(L, "luabins", wrap_luaopen_luabins);
4253

4354
lua_pop(L, 2);
4455

0 commit comments

Comments
 (0)