You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Libraries can now be registered as a function which will be called when the library is requested. This allows functionality such as libraries that behave differently depending on where the Luacontroller is (for example, a sensor of some sort that only works if the LuaC is next to it) as well as various initialization that the library may need to perform. Supplying a table is still supported and works as before.
Copy file name to clipboardExpand all lines: mesecons_luacontroller/init.lua
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -459,12 +459,20 @@ local function get_digiline_send(pos, itbl, send_warning)
459
459
end
460
460
end
461
461
462
+
-- Mods can place their own "libraries" in here to be loaded via require() from in a Luacontroller.
463
+
-- These can take two different forms:
464
+
-- Function (recommended for libraries adding new functionality): A function that, when called, returns something that will be passed to the LuaC code.
465
+
-- Function signature is getlibrary(env, pos) where 'env' is the environment that the Luacontroller code is running in, and 'pos' is the position of the controller.
466
+
-- Table (recommended for libraries containing mostly lookup tables): A table that will be copied, and the copy returned to the LuaC code.
467
+
-- When using the table format, any functions in the table will have their environment changed to that of the Luacontroller.
0 commit comments