Hopefully my last plugin stumbling block. Sending a table of data back to Lua from an NSDictionary.
I can do this if I know the data types - so I'm just checking that there is no other way apart from going through the NSDictionary keys and checking what data types each value is, and then adding the value to the lua stack table via the lua_push'correcttype' function.
I'd really like a lua_pushanyvalue function, but I don't think it exists.
I can also send back the address of the NSDictionary via lightuserdata, but I don't think that helps, as I don't think I can extract data directly in Lua. Can I?
Also, if I were to (eventually) post code for an iOS plugin, which would consist of a .mm file, and the corresponding Lua file, should I do that on Github or here?
Comments
It has a similar license to Lua and our own examples, that come with Gideros Studio or posted on elsewhere, e.g Github.
Sorry for late reply.
For converting NSDictionary to Lua table, you should push each element with the correct type. Afaik, there is no other easy way. If you want, you can look for functions LuaObjectBridge_pushunboxednsdictionary and LuaObjectBridge_pushunboxedpropertylist here https://bitbucket.org/ewing/luacocoa/src/8d0a08687a3f/LuaCocoa/LuaObjectBridge.m
You can also push NSDictionary as lightuserdata but in this case, you should provide function to get the value in Lua style (and programmer should handle the lifetime of NSDictionary)