Пример #1
0
 public int luaCB_write(Lua l, LuaPlugin plugin) {
   l.pushNil();
   try {
     String towrite = l.checkString(2);
     if (towrite == "") {
       l.pushBoolean(true);
       return 1;
     }
     byte[] tmp = new byte[towrite.length()];
     for (int i = 0; i < towrite.length(); i++) tmp[i] = (byte) towrite.charAt(i);
     object.write(tmp);
     l.pushBoolean(true);
   } catch (IOException e) {
     l.pushBoolean(false);
     l.pushString("IOException: " + e.getMessage());
     return 2;
   }
   return 1;
 }
Пример #2
0
 public void destroy() throws IOException {
   object.close();
   object = null;
 }