人老了容易忘记以前做过事情,第一次写自己的博客!
本文使用的LUA5.1版本
lua.hpp
// lua.hpp
// Lua header files for C++
// <<extern "C">> not supplied automatically because Lua also compiles as C++
#ifdef __cplusplus
extern "C" {
#endif
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#ifdef __cplusplus
}
#endif
Student.h
#ifndef __STUDENT_H_
#define __STUDENT_H_
#include "lua.hpp"
class Student
{
public:
Student();
void SetAge(int nAge);
int GetAge();
int m_nAge;
};
#ifdef __cplusplus
extern "C" {
#endif
int luaopen_student(lua_State *L);
#ifdef __cplusplus
}
#endif
#endif
#include "Student.h"
Student::Student()
{
m