1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-22 21:23:21 +00:00

Fix write method missing from printers

I'm really not very good at this modding lark am I? I've done a basic
search for other missing methods, and can't see anything, but goodness
knows.

Fixes #480
This commit is contained in:
SquidDev 2020-06-23 10:00:46 +01:00
parent 5bd8d84d14
commit c5138c535c

View File

@ -5,6 +5,7 @@
*/
package dan200.computercraft.shared.peripheral.printer;
import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.api.peripheral.IPeripheral;
@ -36,9 +37,10 @@ public String getType()
// FIXME: None of our page modification functions actually mark the tile as dirty, so the page may not be
// persisted correctly.
public final void write( Object[] args ) throws LuaException
@LuaFunction
public final void write( IArguments arguments ) throws LuaException
{
String text = args.length > 0 && args[0] != null ? args[0].toString() : "";
String text = StringUtil.toString( arguments.get( 0 ) );
Terminal page = getCurrentPage();
page.write( text );
page.setCursorPos( page.getCursorX() + text.length(), page.getCursorY() );