Available on github:
http://github.com/carolight/CBSamplePluginYou need at least Beta 7 of Gideros Studio.
This sample contains a Gideros project called CBSamplePlugin and a CGSamplePlugin.mm file to be added to the GiderosiPhonePlayer app in Xcode. The project needs to be run on the iPhone device.
I haven't attempted a real life plugin example, just documented how to send and receive and iterate different types of data in 7 sample code pieces. The outputs of each are presented in both the Xcode debug console, and the Gideros Studio output console.
For a real life plugin, see gamekit, which comes with Beta 7.
I am new to Lua and C++ and github, and I don't understand everything yet, so if I have made any errors, or if there are better ways to do things, or if you have any questions, or any suggestions of further samples, please let me know.
Samples are:
1. Send two integers to the plugin to be added together and return an integer result
2. Send a string to the plugin. When the string is received, the plugin dispatches an event, returning a different string, which is picked up in Lua. (tricky
)
3. Send a table with keys to an NSDictionary
4. Send a table array for sorting and return the sorted table array
5. Create a new table of localised day names in the plugin and return it to Lua
6. Similar to Sample 3 - create NSDictionaries of personData, this time saving the NSDictionaries in an array in the Objective C helper class. Return the array count and a pointer to the array using lightuserdata. Get a personData table back from the array using the array pointer.
7. Create a callback function, with variable arguments. This will be a Lua function called from the plugin.
I have not documented every C API function - the manual for the API is here:
http://www.lua.org/manual/5.1/manual.html#3I found this discussion useful for concepts:
http://forums.tigsource.com/index.php?topic=22524.0
Comments
I'll reference your work everywhere.
Thank you for your perfectly coded plugin, It's such a great contribution. =D>
Very noob-friendly! ^:)^
Thanks for the starting point
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
There's also the Plugin section in the Ultimate Guide, that may have other pointers. (That was written after this example, and uses some of the same code.)
@techdojo. Ok Ok, I will work more on it.
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill