Posts: 33
Threads: 10
Joined: Dec 2016
Thanks: 10
Given 0 thank(s) in 0 post(s)
hi there,
how i can add a function/parameter to a existing class like cPlayer?
Example:
cPlayer:getBedPos(World)
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
You need to implement the function in C++ code, and in the .h file, mark it with an "// tolua_export" comment right after the declaration. Then you need to document the API - that's in the Server/Plugins/APIDump folder; the format should be pretty self-explanatory.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
What, you mean you want to add a method to a class from a plugin? That's impossible.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
It has such limits that it's not worth doing. I assume the original request is to make a plugin that adds an API function for other plugins to use, so this won't work. And as noted, the custom functions and variables may not survive for long.