Attempt to call string (Java LuaJ)

50 Views Asked by At

I've been trying to interact with my java project using lua with LuaJ. But I have some problems since im trying to use this to interact with the minecraft client API.

My code:

Globals globals = JsePlatform.standardGlobals();
            LuaValue displayTable = CoerceJavaToLua.coerce(Display.class);
            globals.set("Display", displayTable);
            LuaValue luaCode = LuaValue.valueOf(
                    "setTitle = 'hi'"
            );

            try {
                LuaValue chunk = globals.load(luaCode);
                chunk.call();
            } catch (LuaError e) {
                System.err.println("LuaError: " + e.getMessage());
                e.printStackTrace();
            }

I've been getting this error though when this part of the code is ran:

org.luaj.vm2.LuaError: attempt to call string
  at org.luaj.vm2.LuaValue.checkmetatag(Unknown Source)
  at org.luaj.vm2.LuaValue.callmt(Unknown Source)
  at org.luaj.vm2.LuaValue.call(Unknown Source)
  at org.luaj.vm2.LuaValue.load(Unknown Source)
  at me.soulgodd.luxury.Luxury.luacompile(Luxury.java:48)
  at me.soulgodd.luxury.module.combat.KillAura.onUpdate(KillAura.java:55)
  at me.soulgodd.luxury.module.ModuleManager.onUpdate(ModuleManager.java:30)
  at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:719)
  at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1825)
  at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:333)
  at net.minecraft.client.entity.EntityPlayerSP.onUpdate(EntityPlayerSP.java:173)
  at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:1879)
  at net.minecraft.world.World.updateEntity(World.java:1848)
  at net.minecraft.world.World.updateEntities(World.java:1700)
  at net.minecraft.client.Minecraft.runTick(Minecraft.java:2192)
  at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1106)
  at net.minecraft.client.Minecraft.run(Minecraft.java:423)
  at net.minecraft.client.main.Main.main(Main.java:113)
  at Start.main(Start.java:11)


I'm new to java so can someone help.
0

There are 0 best solutions below