Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giginet/ccluaparser
https://github.com/giginet/ccluaparser
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/giginet/ccluaparser
- Owner: giginet
- Created: 2015-05-10T09:53:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-12T13:25:20.000Z (over 9 years ago)
- Last Synced: 2025-01-19T16:49:52.375Z (5 days ago)
- Language: C++
- Size: 121 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CCLuaParser
This is a utility class for cocos2d-x 3.x Lua-Binding.
## Usage
You must be able to load `CCLuaEngine.h` in your project.
### Execute Function
```lua
function addTwoNumbers(a, b)
return a + b
end
``````cpp
// Initialize LuaParser with the script file.
// Each parsers have independent LuaStack.
luaParser::LuaParser * parser = luaParser::LuaParser::create("script.lua");// Define arguments of the function as cocos2d::LuaValue.
cocos2d::LuaValueArray args = {
cocos2d::LuaValue::intValue(5),
cocos2d::LuaValue::intValue(5)
};// Call executeFunction(, , );
cocos2d::LuaValueArray returnValues = parser->executeFunction("addTwoNumbers", args, 1);// You can get return values as LuaValueArray.
// Get the first return value in the following way.
cocos2d::LuaValue returnValue = returnValues.front();// Print the calc result.
cocos2d::log("answer = %d", returnValue.intValue());
```### Parse Lua table recursively
WIP