/** Set a value in a table without metatag processing using {@link #NEWINDEX}. * @param key the key to use, must not be null * @param value the value to use * @throws LuaError if {@code this} is not a table, * or there is no {@link #NEWINDEX} metatag */ public void set( String key, double value ) { set(valueOf(key), valueOf(value) ); }
/** Set a value in a table without metatag processing using {@link #NEWINDEX}. * @param key the key to use, must not be null * @param value the value to use, must not be null * @throws LuaError if {@code this} is not a table, * or there is no {@link #NEWINDEX} metatag */ public void set( String key, String value ) { set(valueOf(key), valueOf(value) ); }
/** Set a value in a table without metatag processing. * @param key the key to use * @param value the value to use, can be {@link #NIL}, must not be null * @throws LuaError if {@code this} is not a table */ public void rawset( int key, String value ) { rawset(key,valueOf(value)); }
/** Get a value in a table including metatag processing using {@link #INDEX}. * @param key the key to look up, must not be null * @return {@link LuaValue} for that key, or {@link #NIL} if not found * @throws LuaError if {@code this} is not a table, * or there is no {@link #INDEX} metatag * @see #get(LuaValue) * @see #rawget(String) */ public LuaValue get( String key ) { return get(valueOf(key)); }
/** Get a value in a table without metatag processing. * @param key the key to look up * @return {@link LuaValue} for that key, or {@link #NIL} if not found * @throws LuaError if {@code this} is not a table */ public LuaValue rawget( int key ) { return rawget(valueOf(key)); }
/** Set a value in a table without metatag processing. * @param key the key to use * @param value the value to use, can be {@link #NIL}, must not be null * @throws LuaError if {@code this} is not a table */ public void rawset( int key, LuaValue value ) { rawset(valueOf(key),value); }
/** Convenience function which calls a luavalue with a single, string argument. * @param arg String argument to the function. This will be converted to a LuaString. * @return return value of the invocation. * @see #call(LuaValue) */ public LuaValue call(String arg) { return call(valueOf(arg)); }
boolean str2d(String str, SemInfo seminfo) { if (str.indexOf('n')>=0 || str.indexOf('N')>=0) seminfo.r = LuaValue.ZERO; else if (str.indexOf('x')>=0 || str.indexOf('X')>=0) seminfo.r = strx2number(str, seminfo); else seminfo.r = LuaValue.valueOf(Double.parseDouble(str.trim())); return true; }
/** Set a value in a table without metatag processing using {@link #NEWINDEX}. * @param key the key to use * @param value the value to use, must not be null * @throws LuaError if {@code this} is not a table, * or there is no {@link #NEWINDEX} metatag */ public void set( int key, String value ) { set(key, valueOf(value) ); }
/** Get a value in a table without metatag processing. * @param key the key to look up * @return {@link LuaValue} for that key, or {@link #NIL} if not found * @throws LuaError if {@code this} is not a table */ public LuaValue rawget( int key ) { return rawget(valueOf(key)); }
/** Convenience function which calls a luavalue with a single, string argument. * @param arg String argument to the function. This will be converted to a LuaString. * @return return value of the invocation. * @see #call(LuaValue) */ public LuaValue call(String arg) { return call(valueOf(arg)); }
/** Set the lua path used by this library instance to a new value. * Merely sets the value of {@link path} to be used in subsequent searches. */ public void setLuaPath( String newLuaPath ) { package_.set(_PATH, LuaValue.valueOf(newLuaPath)); }
/** Set a value in a table without metatag processing using {@link #NEWINDEX}. * @param key the key to use * @param value the value to use, must not be null * @throws LuaError if {@code this} is not a table, * or there is no {@link #NEWINDEX} metatag */ public void set( int key, String value ) { set(key, valueOf(value) ); }
/** Get a value in a table without metatag processing. * @param key the key to look up, must not be null * @return {@link LuaValue} for that key, or {@link #NIL} if not found * @throws LuaError if {@code this} is not a table */ public LuaValue rawget( String key ) { return rawget(valueOf(key)); }
public Varargs resume(Varargs args) { final LuaThread.State s = this.state; if (s.status > LuaThread.STATUS_SUSPENDED) return LuaValue.varargsOf(LuaValue.FALSE, LuaValue.valueOf("cannot resume "+(s.status==LuaThread.STATUS_DEAD? "dead": "non-suspended")+" coroutine")); return s.lua_resume(this, args); }
public Varargs resume(Varargs args) { final LuaThread.State s = this.state; if (s.status > LuaThread.STATUS_SUSPENDED) return LuaValue.varargsOf(LuaValue.FALSE, LuaValue.valueOf("cannot resume "+(s.status==LuaThread.STATUS_DEAD? "dead": "non-suspended")+" coroutine")); return s.lua_resume(this, args); }
@Test public void testString() { System.out.println("\ntestString"); LuaValue value = LuaValue.valueOf("hello world"); println(value); }