summaryrefslogtreecommitdiff
path: root/Runtime/Lua/LuaHelper.h
blob: 79cab29e13f283bca0eea0e33889b65d3121380f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once
#include "./LuaBind/LuaBind.h"

// lua 5.1 doc: https://www.lua.org/manual/5.1/

// 针对GameLab做一些扩展
class LuaHelper 
{
public:
    static int Call(const char* func, const char* params, ...);
	static bool IsType(LuaBind::State& state, const char* typeName, int idx);
	static void OnRegisterNativeClass(LuaBind::State& state, int cls, std::string clsName, std::string pkgName);
    // 创建lua类的实例并留在栈顶,如果失败返回false且不压栈
    static bool InstantiateClass(LuaBind::State& state, const char* classFullName);

    // 找到类table,并留在栈顶,如果返回false表示没有找到,栈顶无值
    static bool GetLuaClass(LuaBind::State& state, const char* fullName);
    
};