05-20-2017, 12:51 AM
05-20-2017, 12:54 AM
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.
05-20-2017, 12:58 AM
(05-20-2017, 12:54 AM)xoft Wrote: [ -> ]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.
Okay thanks... do you know if other plugins exist for an example?
05-20-2017, 09:04 AM
What, you mean you want to add a method to a class from a plugin? That's impossible.
05-21-2017, 12:14 AM
No it's not, I did it before with cBlockArea: https://forum.cuberite.org/thread-569-po...l#pid15474
cPlayer was a bit harder to do. First I had to get rid of the metatable, put the function inside and then put the metatable in there again.
cPlayer was a bit harder to do. First I had to get rid of the metatable, put the function inside and then put the metatable in there again.
05-21-2017, 12:38 AM
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.