globals.get("key") returns the LuaValue of an object in the globals table, it is not used to do expressions. The code you're giving as an example is trying to find a variable named "var_tex1 == 3 and 100 or -1", which is returning null because no such variable exists.
If you need 100 or -1 you should try to calculate it in Java:
int result = globals.get("var_tex1").checkint() == 3 ? 100 : -1;
If you need the result to be a LuaValue you can do something more like the following:
public static final LuaValue Lua_100 = LuaInteger.valueOf(100);
public static final LuaValue Lua_n1 = LuaInteger.valueOf(-1);
public LuaValue check() {
return globals.get("var_tex1").checkint() == 3 ? Lua_100 : Lua_n1;
}
The other option is to do exactly as you did for setting the value:
public LuaValue eval(String s)
{
LuaValue chunk = globals.load("__temp_result__=" + s);
chunk.call();
LuaValue result = globals.get("_temp_result_");
globals.set("__temp_result__", LuaValue.NIL);
return result;
}
Then call:
LuaValue result = eval("var_tex1 == 3 and 100 or -1");
If you want an integer instead of LuaValue just call checkint() on the LuaValue