Jump to content

Accessing Public Attributes of Public Java Classes from Lua Scripts


Razer

Recommended Posts

I'm relatively new to PZ modding, and the kahlua tutorials or documents over the internet are quite rare. Let me ask this question: is it possible to access public attributes of public Java classes from lua scripts?

I'm sure calling public methods is viable. But there are many public attributes that didn't come with get/set methods, and try accessing them directly causes trouble. 

For example, "print(obj.attribute)" will always output nil, and "obj.attribute = some value" would trigger errors, which read like the class of obj isn't exposed enough for you to access its attributes.

Please tell me if there is a way to make this, really appreciate!

Link to comment
Share on other sites

  • 2 months later...
3 hours ago, Kenneth said:

Hey here is a solution in this post

 

 

Wow, I didn't know there's a method looks as magical as "getClassField()". This will be very handy if I can't find a more viable method but have to achieve something. Many thanks for your reply!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...