上一章傳送門:http://www.companysz.com/tech/jiaoben/lua/265346.html
本章我們來學習一個小Demo,也就是上一章中的場景:C++從Lua中獲取一個全局變量的字符串。
1. 引入頭文件
我們來看看要在C++中使用Lua,需要些什么東西
#ifndef __HELLO_LUA_H_
#define __HELLO_LUA_H_
#include "cocos2d.h"
extern "C" {
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
};
using namespace cocos2d;
class HelloLua : public CCLayer {
public:
CREATE_FUNC(HelloLua);
virtual bool init();
static CCScene* scene();
};
#endif
看到紅色粗體的代碼了嗎?(旁白:在哪呢?在哪啊?)
在這:
新聞熱點
疑難解答