javalualuajava

Luajava: change java public static variable value in lua


I have following java code.

public class Settings {

    public static float delay= 3f; // in seconds


}

And following lua code

local a = luajava.bindClass("Settings");
print (a.delay) -- works normally
-- a.delay = 5; -- this will cause "attempt to index local "a"

I can't set new value to the public static variable "delay". Can I override java public static variable in lua?


Solution

  • Variables in interfaces are always implicitly final, which is why they can't be overwritten.