Java Code Examples for org.luaj.vm2.LuaString#copyInto()
The following examples show how to use
org.luaj.vm2.LuaString#copyInto() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoerceLuaToJava.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public Object coerce(LuaValue value) { if (value.isnil()) return null; if (targetType == TARGET_TYPE_STRING) return value.tojstring(); LuaString s = value.checkstring(); byte[] b = new byte[s.m_length]; s.copyInto(0, b, 0, b.length); return b; }
Example 2
Source File: StringLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
/** * string.rep (s, n) * <p> * Returns a string that is the concatenation of n copies of the string s. */ static Varargs rep(Varargs args) { LuaString s = args.checkstring(1); int n = args.checkint(2); byte[] bytes = new byte[s.length() * n]; int len = s.length(); for (int offset = 0; offset < bytes.length; offset += len) { s.copyInto(0, bytes, offset, len); } return LuaString.valueOf(bytes); }
Example 3
Source File: CoerceLuaToJava.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public Object coerce(LuaValue value) { if ( value.isnil() ) return null; if ( targetType == TARGET_TYPE_STRING ) return value.tojstring(); LuaString s = value.checkstring(); byte[] b = new byte[s.m_length]; s.copyInto(0, b, 0, b.length); return b; }
Example 4
Source File: StringLib.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { LuaString s = args.checkstring( 1 ); int n = args.checkint( 2 ); final byte[] bytes = new byte[ s.length() * n ]; int len = s.length(); for ( int offset = 0; offset < bytes.length; offset += len ) { s.copyInto( 0, bytes, offset, len ); } return LuaString.valueUsing( bytes ); }
Example 5
Source File: CoerceLuaToJava.java From HtmlNative with Apache License 2.0 | 5 votes |
public Object coerce(LuaValue value) { if ( value.isnil() ) return null; if ( targetType == TARGET_TYPE_STRING ) return value.tojstring(); LuaString s = value.checkstring(); byte[] b = new byte[s.m_length]; s.copyInto(0, b, 0, b.length); return b; }
Example 6
Source File: StringLib.java From HtmlNative with Apache License 2.0 | 5 votes |
public Varargs invoke(Varargs args) { LuaString s = args.checkstring( 1 ); int n = args.checkint( 2 ); final byte[] bytes = new byte[ s.length() * n ]; int len = s.length(); for ( int offset = 0; offset < bytes.length; offset += len ) { s.copyInto( 0, bytes, offset, len ); } return LuaString.valueUsing( bytes ); }
Example 7
Source File: CoerceLuaToJava.java From luaj with MIT License | 5 votes |
public Object coerce(LuaValue value) { if ( value.isnil() ) return null; if ( targetType == TARGET_TYPE_STRING ) return value.tojstring(); LuaString s = value.checkstring(); byte[] b = new byte[s.m_length]; s.copyInto(0, b, 0, b.length); return b; }
Example 8
Source File: StringLib.java From luaj with MIT License | 5 votes |
public Varargs invoke(Varargs args) { LuaString s = args.checkstring( 1 ); int n = args.checkint( 2 ); final byte[] bytes = new byte[ s.length() * n ]; int len = s.length(); for ( int offset = 0; offset < bytes.length; offset += len ) { s.copyInto( 0, bytes, offset, len ); } return LuaString.valueUsing( bytes ); }