예제 #1
0
 public int luaCB_close(Lua l, LuaPlugin plugin) {
   try {
     plugin.destroyLuaObject(l);
     l.pushBoolean(true);
   } catch (IOException e) {
     l.pushBoolean(false);
     l.pushString("IOException: " + e.getMessage());
     return 2;
   }
   return 1;
 }
예제 #2
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;
 }