LuaTinker

lua_tinker浅析 Lua也用了有段时间了,lua跟c++的交互以前用的是lua_bind,但是需要boost库,太大了,我的需求也没那么多。所以项目引入lua的时候,我决定找个简单点的库,这时候发现了lua_tinker,很小巧,就两个文件 一个.h和.cpp,引入也很方便。网上看了看教程,我要的功能都有了,就是它了。 用了这么长时间,也没仔细研究研究,也就是机械的用而已,这样可不行。 花了两天时间研究它,下 阅读详情
 

LuaTinker的作者是Kwon-il Lee韩国人写的,最新的版本是0.2.C,这个C++ wrapper For Lua能够方便和

快捷与C/C++通信,LuaTinker参考了luabind和luaplus的特征写的,虽然没有bindlua和luaplus这本强大

和提供很多功能,LuaTinker的实现只有两个文件,但是LuaTinker提供的基本能够满足大部的要求,用户

还可以对它进一步的扩充,而且用于游戏上特为方便,以下是LuaTinker使用C++结构和类的例子:

// 一个基类
struct base
{
 base() {}

 const char* is_base(){ return "this is base"; }
};

// 一个测试类
class test : public base
{
public:
 test(int val) : _test(val) {}
 ~test() {}

 const char* is_test(){ return "this is test"; }

 void ret_void() {}
 int ret_int()   { return _test;   }
 int ret_mul(int m) const { return _test * m;  }
 A get()    { return A(_test);  }
 void set(A a)   { _test = a.value;  }
 int _test;
};

int main()
{
 // 注册base类型到LUA
 lua_tinker::class_<base>("base")
  .def("is_base", &base::is_base)
  ;
 
 // 注册test类型到LUA,注册test的成员函数和成员变量
 lua_tinker::class_<test>("test")
  .inh<base>() // 注册继承类
  .def(lua_tinker::constructor<int>()) //注册构造函数
  .def("is_test", &test::is_test)           // 注册成员函数
  .def("ret_void", &test::ret_void)
  .def("ret_int", &test::ret_int)
  .def("ret_mul", &test::ret_mul)
  .def("get", &test::get)
  .def("set", &test::set)
  .def_readwrite("_test", &test::_test) // 注册成员变量
  ;

 test g_test(11);
 
 lua_tinker::decl("g_test", &g_test);
 
}

// Lua脚本
temp = test(4)  创建一个test类
print(temp._test) 打印test的_test成员

print(g_test)     
print(g_test._test) 打印g_test的成员变量_test
print(g_test:is_test()) 输出信息  
print(g_test:ret_int()) 返回g_test的成员变量_test

这么几句就能够方便的使用C/C++定义的结构或类,下一篇将会介绍其他的用法.
介绍完用法之后会从结构上分析lua_tinker的结构和设计.

 

 

// lua_tinker.h
//
// LuaTinker - Simple and light C++ wrapper for Lua.
//
// Copyright (c) 2005 Kwon-il Lee (zupet@hitel.net)
//
// please check Licence.txt file for licence and legal issues.

#if !defined(_LUA_TINKER_H_)
#define _LUA_TINKER_H_

#include <new>

namespace lua_tinker
{
 // debug helpers
 void enum_stack(lua_State *L, int start=0);
 int  _exception(lua_State *L);

 void dofile(const char *filename);
 void dostring(const char* buff);
 void dobuffer(const char* buff, size_t sz);

 void dofile(lua_State *L, const char *filename);
 void dostring(lua_State *L, const char* buff);
 void dobuffer(lua_State *L, const char* buff, size_t sz);

 // basic Object
 struct lua_state
 {
  static void open(lua_State *in)
  {
   L(in);
   init_s64(in);
   init_u64(in);
  }

  static lua_State* L(lua_State *in=NULL);
  static void   init_s64(lua_State *L);
  static void   init_u64(lua_State *L);
 };

 // for LuaBind
 struct luabind : lua_state
 {
 };

 struct lua_obj
 {
  lua_obj& operator,(const lua_obj& obj) { return *this; }
 };

 struct module
 {
  module(lua_State *L){}
  void operator[](const lua_obj& obj){}
 };

 struct lua_value
 {
  virtual void to_lua(lua_State *L) = 0;
 };

 // type trait
 template<typename T> struct class_;

 template<bool C, typename A, typename B>
 struct if_ {};
 template<typename A, typename B>
 struct if_<true, A, B> { typedef A type; };
 template<typename A, typename B>
 struct if_<false, A, B> { typedef B type; };

 template<typename A>
 struct is_ptr { static const bool value = false; };
 template<typename A>
 struct is_ptr<A*> { static const bool value = true; };

 template<typename A>
 struct is_ref { static const bool value = false; };
 template<typename A>
 struct is_ref<A&> { static const bool value = true; };

 template<typename A>
 struct remove_const { typedef A type; };
 template<typename A>
 struct remove_const<const A> { typedef A type; };

 template<typename A>
 struct base_type { typedef A type; };
 template<typename A>
 struct base_type<A*> { typedef A type; };
 template<typename A>
 struct base_type<A&> { typedef A type; };

 template<typename A>
 struct class_type { typedef typename remove_const<typename base_type<A>::type>::type type; };
 
 /////////////////////////////////
 enum { no = 1, yes = 2 };
 typedef char (& no_type )[no];
 typedef char (& yes_type)[yes];

 struct int_conv_type { int_conv_type(int); };

 no_type int_conv_tester (...);
 yes_type int_conv_tester (int_conv_type);

 no_type vfnd_ptr_tester (const volatile char *);
 no_type vfnd_ptr_tester (const volatile short *);
 no_type vfnd_ptr_tester (const volatile int *);
 no_type vfnd_ptr_tester (const volatile long *);
 no_type vfnd_ptr_tester (const volatile double *);
 no_type vfnd_ptr_tester (const volatile float *);
 no_type vfnd_ptr_tester (const volatile bool *);
 yes_type vfnd_ptr_tester (const volatile void *);

 template <typename T> T* add_ptr(T&);

 template <bool C> struct bool_to_yesno { typedef no_type type; };
 template <> struct bool_to_yesno<true> { typedef yes_type type; };

 template <typename T>
 struct is_enum
 {
  static T arg;
  static const bool value = ( (sizeof(int_conv_tester(arg)) == sizeof(yes_type)) && (sizeof(vfnd_ptr_tester(add_ptr(arg))) == sizeof(yes_type)) );
 };
 /////////////////////////////////

 // from lua
 template<typename T>
 struct void2val { static T invoke(void* input){ return *(T*)input; } };
 template<typename T>
 struct void2ptr { static T* invoke(void* input){ return (T*)input; } };
 template<typename T>
 struct void2ref { static T& invoke(void* input){ return *(T*)input; } };

 template<typename T> 
 struct void2type
 {
  static T invoke(void* ptr)
  {
   return if_<is_ptr<T>::value
      ,void2ptr<base_type<T>::type>
      ,if_<is_ref<T>::value
       ,void2ref<base_type<T>::type>
       ,void2val<base_type<T>::type>
      >::type
     >::type::invoke(ptr);
  }
 };

 template<typename T> 
 struct user2type { static T invoke(lua_State *L, int index) { return void2type<T>::invoke(lua_touserdata(L, index)); } };

 template<typename T>
 struct lua2enum { static T invoke(lua_State *L, int index) { return (T)(int)lua_tonumber(L, index); } };

 template<typename T>
 struct lua2object
 {
  static T invoke(lua_State *L, int index)
  {
   if(!lua_isuserdata(L,index))
   {
    lua_pushstring(L, "no class at first argument. (forgot ':' expression ?)");
    lua_error(L);
   }
   return void2type<T>::invoke(user2type<user*>::invoke(L,index)->m_p);
  }
 };

 template<typename T>
 struct lua2type
 {
  static T invoke(lua_State *L, int index)
  {
   return if_<is_enum<T>::value
      ,lua2enum<T>
      ,lua2object<T>
     >::type::invoke(L, index);
  }
 };

 struct user
 {
  user(void* p) : m_p(p) {}
  virtual ~user() {}
  void* m_p;
 };

 template<typename T>
 struct val2user : user
 {
  val2user() : user(new T) {}

  template<typename T1>
  val2user(T1 t1) : user(new T(t1)) {}

  template<typename T1, typename T2>
  val2user(T1 t1, T2 t2) : user(new T(t1, t2)) {}

  template<typename T1, typename T2, typename T3>
  val2user(T1 t1, T2 t2, T3 t3) : user(new T(t1, t2, t3)) {}

  ~val2user() { delete ((T*)m_p); }
 };

 template<typename T>
 struct ptr2user : user
 {
  ptr2user(T* t) : user((void*)t) {}
 };

 template<typename T>
 struct ref2user : user
 {
  ref2user(T& t) : user(&t) {}
 };

 // to lua
 template<typename T>
 struct val2lua { static void invoke(lua_State *L, T& input){ new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(input); } };
 template<typename T>
 struct ptr2lua { static void invoke(lua_State *L, T* input){ if(input) new(lua_newuserdata(L, sizeof(ptr2user<T>))) ptr2user<T>(input); else lua_pushnil(L); } };
 template<typename T>
 struct ref2lua { static void invoke(lua_State *L, T& input){ new(lua_newuserdata(L, sizeof(ref2user<T>))) ref2user<T>(input); } };

 template<typename T>
 struct enum2lua { static void invoke(lua_State *L, T val) { lua_pushnumber(L, (int)val); } };

 template<typename T>
 struct object2lua
 {
  static void invoke(lua_State *L, T val)
  {
   if_<is_ptr<T>::value
    ,ptr2lua<base_type<T>::type>
    ,if_<is_ref<T>::value
     ,ref2lua<base_type<T>::type>
     ,val2lua<base_type<T>::type>
    >::type
   >::type::invoke(L, val);

   class_<class_type<T>::type>::push_meta(L);
   lua_setmetatable(L, -2);
  }
 };

 template<typename T>
 struct type2lua
 {
  static void invoke(lua_State *L, T val)
  {
   if_<is_enum<T>::value
    ,enum2lua<T>
    ,object2lua<T>
   >::type::invoke(L, val);
  };
 };

 //
 template<typename T> 
 T func_(lua_State *L)
 {
  return user2type<T>::invoke(L, lua_upvalueindex(1));
 }

 // arguments
 struct pop_
 {
  template<typename T> 
  static T invoke(lua_State *L, int index)    { return lua2type<T>::invoke(L, index);     }
  template<>
  static char* invoke(lua_State *L, int index)   { return (char*)lua_tostring(L, index);     }
  template<>
  static const char* invoke(lua_State *L, int index)  { return (const char*)lua_tostring(L, index);   }
  template<>
  static char invoke(lua_State *L, int index)    { return (char)lua_tonumber(L, index);     }
  template<>
  static unsigned char invoke(lua_State *L, int index) { return (unsigned char)lua_tonumber(L, index);   }
  template<>
  static short invoke(lua_State *L, int index)   { return (short)lua_tonumber(L, index);     }
  template<>
  static unsigned short invoke(lua_State *L, int index) { return (unsigned short)lua_tonumber(L, index);  }
  template<>
  static long invoke(lua_State *L, int index)    { return (long)lua_tonumber(L, index);     }
  template<>
  static unsigned long invoke(lua_State *L, int index) { return (unsigned long)lua_tonumber(L, index);   }
  template<>
  static int invoke(lua_State *L, int index)    { return (int)lua_tonumber(L, index);     }
  template<>
  static unsigned int invoke(lua_State *L, int index)  { return (unsigned int)lua_tonumber(L, index);   }
  template<>
  static float invoke(lua_State *L, int index)   { return (float)lua_tonumber(L, index);     }
  template<>
  static double invoke(lua_State *L, int index)   { return (double)lua_tonumber(L, index);    }
  template<>
  static bool invoke(lua_State *L, int index)    { return lua_toboolean(L, index) != 0;     }
  template<>
  static void invoke(lua_State *L, int index)    { return;            }
  template<>
  static __int64 invoke(lua_State *L, int index)
  {
   if(lua_isnumber(L,index))
    return (__int64)lua_tonumber(L, index);
   else
    return *(__int64*)lua_touserdata(L, index);
  }
  template<>
  static unsigned __int64 invoke(lua_State *L, int index)
  {
   if(lua_isnumber(L,index))
    return (unsigned __int64)lua_tonumber(L, index);
   else
    return *(unsigned __int64*)lua_touserdata(L, index);
  }
 };

 // return value
 struct push_
 {
  template<typename T> 
  static void invoke(lua_State *L, T ret)     { type2lua<T>::invoke(L, ret); }
  template<>
  static void invoke(lua_State *L, char ret)    { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, unsigned char ret)  { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, short ret)    { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, unsigned short ret) { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, long ret)    { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, unsigned long ret)  { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, int ret)    { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, unsigned int ret)  { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, float ret)    { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, double ret)   { lua_pushnumber(L, ret);  }
  template<>
  static void invoke(lua_State *L, char* ret)    { lua_pushstring(L, ret);  }
  template<>
  static void invoke(lua_State *L, const char* ret)  { lua_pushstring(L, ret);  }
  template<>
  static void invoke(lua_State *L, bool ret)    { lua_pushboolean(L, ret);  }
  template<>
  static void invoke(lua_State *L, lua_value* ret)  { if(ret) ret->to_lua(L); else lua_pushnil(L); }
  template<>
  static void invoke(lua_State *L, __int64 ret)   
  {
   *(__int64*)lua_newuserdata(L, sizeof(__int64)) = ret;
   lua_pushstring(L, "__s64");
   lua_gettable(L, LUA_GLOBALSINDEX);
   lua_setmetatable(L, -2);
  }
  template<>
  static void invoke(lua_State *L, unsigned __int64 ret)
  {
   *(unsigned __int64*)lua_newuserdata(L, sizeof(unsigned __int64)) = ret;
   lua_pushstring(L, "__u64");
   lua_gettable(L, LUA_GLOBALSINDEX);
   lua_setmetatable(L, -2);
  }
 };

 template<typename T>
 struct ret_ { static const int value = 1; };
 template<>
 struct ret_<void> { static const int value = 0; };

 // caller
 template<typename T1=void, typename T2=void, typename T3=void, typename T4=void, typename T5=void>
 struct caller
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,func_<RVal(*)(T1,T2,T3,T4,T5)>(L)(pop_::invoke<T1>(L,1),pop_::invoke<T2>(L,2),pop_::invoke<T3>(L,3),pop_::invoke<T4>(L,4),pop_::invoke<T5>(L,5))); }
  template<>
  static void invoke<void>(lua_State *L) { func_<void(*)(T1,T2,T3,T4,T5)>(L)(pop_::invoke<T1>(L,1),pop_::invoke<T2>(L,2),pop_::invoke<T3>(L,3),pop_::invoke<T4>(L,4),pop_::invoke<T5>(L,5)); }
 };

 template<typename T1, typename T2, typename T3, typename T4>
 struct caller<T1,T2,T3,T4>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,func_<RVal(*)(T1,T2,T3,T4)>(L)(pop_::invoke<T1>(L,1),pop_::invoke<T2>(L,2),pop_::invoke<T3>(L,3),pop_::invoke<T4>(L,4))); }
  template<>
  static void invoke<void>(lua_State *L) { func_<void(*)(T1,T2,T3,T4)>(L)(pop_::invoke<T1>(L,1),pop_::invoke<T2>(L,2),pop_::invoke<T3>(L,3),pop_::invoke<T4>(L,4)); }
 };

 template<typename T1, typename T2, typename T3>
 struct caller<T1,T2,T3>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,func_<RVal(*)(T1,T2,T3)>(L)(pop_::invoke<T1>(L,1),pop_::invoke<T2>(L,2),pop_::invoke<T3>(L,3))); }
  template<>
  static void invoke<void>(lua_State *L) { func_<void(*)(T1,T2,T3)>(L)(pop_::invoke<T1>(L,1),pop_::invoke<T2>(L,2),pop_::invoke<T3>(L,3)); }
 };

 template<typename T1, typename T2>
 struct caller<T1,T2>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,func_<RVal(*)(T1,T2)>(L)(pop_::invoke<T1>(L,1),pop_::invoke<T2>(L,2))); }
  template<>
  static void invoke<void>(lua_State *L) { func_<void(*)(T1,T2)>(L)(pop_::invoke<T1>(L,1),pop_::invoke<T2>(L,2)); }
 };

 template<typename T1>
 struct caller<T1>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,func_<RVal(*)(T1)>(L)(pop_::invoke<T1>(L,1))); }
  template<>
  static void invoke<void>(lua_State *L) { func_<void(*)(T1)>(L)(pop_::invoke<T1>(L,1)); }
 };

 template<>
 struct caller<void>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,func_<RVal(*)()>(L)()); }
  template<>
  static void invoke<void>(lua_State *L) { func_<void(*)()>(L)(); }
 };

 // function
 template<typename T1=void, typename T2=void, typename T3=void, typename T4=void, typename T5=void>
 struct functor
 {
  template<typename RVal>
  static int invoke(lua_State *L) { caller<T1,T2,T3,T4,T5>::invoke<RVal>(L); return ret_<RVal>::value; }
 };

 template<typename RVal>
 void push_func(lua_State *L, RVal (*func)())
 {
  lua_pushcclosure(L, functor<>::invoke<RVal>, 1);
 }

 template<typename RVal,class T1>
 void push_func(lua_State *L, RVal (*func)(T1))
 {
  lua_pushcclosure(L, functor<T1>::invoke<RVal>, 1);
 }

 template<typename RVal,class T1,class T2>
 void push_func(lua_State *L, RVal (*func)(T1,T2))
 {
  lua_pushcclosure(L, functor<T1,T2>::invoke<RVal>, 1);
 }

 template<typename RVal,class T1,class T2, typename T3>
 void push_func(lua_State *L, RVal (*func)(T1,T2,T3))
 {
  lua_pushcclosure(L, functor<T1,T2,T3>::invoke<RVal>, 1);
 }

 template<typename RVal,class T1,class T2, typename T3, typename T4>
 void push_func(lua_State *L, RVal (*func)(T1,T2,T3,T4))
 {
  lua_pushcclosure(L, functor<T1,T2,T3,T4>::invoke<RVal>, 1);
 }

 template<typename RVal,class T1,class T2, typename T3, typename T4, typename T5>
 void push_func(lua_State *L, RVal (*func)(T1,T2,T3,T4,T5))
 {
  lua_pushcclosure(L, functor<T1,T2,T3,T4,T5>::invoke<RVal>, 1);
 }

 // member variable
 template<typename T>
 T* this_(lua_State *L)
 {
  return pop_::invoke<T*>(L, 1);
 }

 struct var_base
 {
  virtual void get(lua_State *L) = 0;
  virtual void set(lua_State *L) = 0;
 };

 template<typename T, typename V>
 struct mem_var : var_base
 {
  V T::*_var;
  mem_var(V T::*val) : _var(val) {}
  void get(lua_State *L) { push_::invoke(L, this_<T>(L)->*(_var));  }
  void set(lua_State *L) { this_<T>(L)->*(_var) = pop_::invoke<V>(L, 3); }
 };

 // member function
 template<typename T,class T1=void, typename T2=void, typename T3=void, typename T4=void, typename T5=void>
 struct mem_caller
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,(this_<T>(L)->*func_<RVal(T::*)(T1,T2,T3,T4,T5)>(L))(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3),pop_::invoke<T3>(L,4),pop_::invoke<T4>(L,5),pop_::invoke<T5>(L,6))); }
  template<>
  static void invoke<void>(lua_State *L)  { (this_<T>(L)->*func_<void(T::*)(T1,T2,T3,T4,T5)>(L))(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3),pop_::invoke<T3>(L,4),pop_::invoke<T4>(L,5),pop_::invoke<T5>(L,6)); }
 };

 template<typename T, typename T1, typename T2, typename T3, typename T4>
 struct mem_caller<T,T1,T2,T3,T4>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,(this_<T>(L)->*func_<RVal(T::*)(T1,T2,T3,T4)>(L))(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3),pop_::invoke<T3>(L,4),pop_::invoke<T4>(L,5))); }
  template<>
  static void invoke<void>(lua_State *L)  { (this_<T>(L)->*func_<void(T::*)(T1,T2,T3,T4)>(L))(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3),pop_::invoke<T3>(L,4),pop_::invoke<T4>(L,5)); }
 };

 template<typename T, typename T1, typename T2, typename T3>
 struct mem_caller<T,T1,T2,T3>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,(this_<T>(L)->*func_<RVal(T::*)(T1,T2,T3)>(L))(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3),pop_::invoke<T3>(L,4))); }
  template<>
  static void invoke<void>(lua_State *L)  { (this_<T>(L)->*func_<void(T::*)(T1,T2,T3)>(L))(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3),pop_::invoke<T3>(L,4)); }
 };

 template<typename T, typename T1, typename T2>
 struct mem_caller<T,T1, T2>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,(this_<T>(L)->*func_<RVal(T::*)(T1,T2)>(L))(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3))); }
  template<>
  static void invoke<void>(lua_State *L)  { (this_<T>(L)->*func_<void(T::*)(T1,T2)>(L))(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3)); }
 };

 template<typename T, typename T1>
 struct mem_caller<T,T1>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,(this_<T>(L)->*func_<RVal(T::*)(T1)>(L))(pop_::invoke<T1>(L,2))); }
  template<>
  static void invoke<void>(lua_State *L)  { (this_<T>(L)->*func_<void(T::*)(T1)>(L))(pop_::invoke<T1>(L,2)); }
 };

 template<typename T>
 struct mem_caller<T>
 {
  template<typename RVal>
  static void invoke(lua_State *L) { push_::invoke(L,(this_<T>(L)->*func_<RVal(T::*)()>(L))()); }
  template<>
  static void invoke<void>(lua_State *L)  { (this_<T>(L)->*func_<void(T::*)()>(L))(); }
 };
 
 //
 template<typename T, typename T1=void, typename T2=void, typename T3=void, typename T4=void, typename T5=void>
 struct mem_functor
 {
  template<typename RVal>
  static int invoke(lua_State *L) { mem_caller<T,T1,T2,T3,T4,T5>::invoke<RVal>(L); return ret_<RVal>::value; }
 };

 template<typename RVal, typename T>
 void push_func(lua_State *L, RVal (T::*func)())
 {
  lua_pushcclosure(L, mem_functor<T>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T>
 void push_func(lua_State *L, RVal (T::*func)() const)
 {
  lua_pushcclosure(L, mem_functor<T>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1>
 void push_func(lua_State *L, RVal (T::*func)(T1))
 {
  lua_pushcclosure(L, mem_functor<T,T1>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1>
 void push_func(lua_State *L, RVal (T::*func)(T1) const)
 {
  lua_pushcclosure(L, mem_functor<T,T1>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1, typename T2>
 void push_func(lua_State *L, RVal (T::*func)(T1,T2))
 {
  lua_pushcclosure(L, mem_functor<T,T1,T2>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1, typename T2>
 void push_func(lua_State *L, RVal (T::*func)(T1,T2) const)
 {
  lua_pushcclosure(L, mem_functor<T,T1,T2>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1, typename T2, typename T3>
 void push_func(lua_State *L, RVal (T::*func)(T1,T2,T3))
 {
  lua_pushcclosure(L, mem_functor<T,T1,T2,T3>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1, typename T2, typename T3>
 void push_func(lua_State *L, RVal (T::*func)(T1,T2,T3) const)
 {
  lua_pushcclosure(L, mem_functor<T,T1,T2,T3>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1, typename T2, typename T3, typename T4>
 void push_func(lua_State *L, RVal (T::*func)(T1,T2,T3,T4))
 {
  lua_pushcclosure(L, mem_functor<T,T1,T2,T3,T4>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1, typename T2, typename T3, typename T4>
 void push_func(lua_State *L, RVal (T::*func)(T1,T2,T3,T4) const)
 {
  lua_pushcclosure(L, mem_functor<T,T1,T2,T3,T4>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
 void push_func(lua_State *L, RVal (T::*func)(T1,T2,T3,T4,T5))
 {
  lua_pushcclosure(L, mem_functor<T,T1,T2,T3,T4,T5>::invoke<RVal>, 1);
 }

 template<typename RVal, typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
 void push_func(lua_State *L, RVal (T::*func)(T1,T2,T3,T4,T5) const)
 {
  lua_pushcclosure(L, mem_functor<T,T1,T2,T3,T4,T5>::invoke<RVal>, 1);
 }

 // constructor
 template<typename T1=void, typename T2=void, typename T3=void, typename T4=void>
 struct constructor {};

 template<typename T1, typename T2, typename T3>
 struct constructor<T1,T2,T3>
 {
  template<typename T>
  static void invoke(lua_State *L)
  {
   new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3),pop_::invoke<T3>(L,4));
  }
 };


 template<typename T1, typename T2>
 struct constructor<T1,T2>
 {
  template<typename T>
  static void invoke(lua_State *L)
  {
   new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(pop_::invoke<T1>(L,2),pop_::invoke<T2>(L,3));
  }
 };

 template<typename T1>
 struct constructor<T1>
 {
  template<typename T>
  static void invoke(lua_State *L)
  {
   new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(pop_::invoke<T1>(L,2));
  }
 };

 template<>
 struct constructor<void>
 {
  template<typename T>
  static void invoke(lua_State *L)
  {
   new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>();
  }
 };

 template<typename T>
 struct creator
 {
  template<typename CONSTRUCTOR>
  static int invoke(lua_State *L)
  {
   CONSTRUCTOR::invoke<T>(L);
   class_<class_type<T>::type>::push_meta(L);
   lua_setmetatable(L, -2);

   return 1;
  }
 };

 // destroyer
 template<typename T>
 struct destroyer
 {
  static int invoke(lua_State *L)
  {
   ((user*)lua_touserdata(L, 1))->~user();
   return 0;
  }
 };

 // get
 int get_var(lua_State *L);
 int set_var(lua_State *L);

 // Tinker Function
 template<typename F>
 lua_obj def(const char* name, F func)
 {
  lua_State *L = lua_state::L();
  lua_pushstring(L, name);
  lua_pushlightuserdata(L, func);
  push_func(L, func);
  lua_settable(L, LUA_GLOBALSINDEX);

  return lua_obj();
 }

 // Tinker Global
 template<typename T>
 lua_obj decl(const char* name, T object)
 {
  lua_State *L = lua_state::L();
  lua_pushstring(L, name);
  push_::invoke(L, object);
  lua_settable(L, LUA_GLOBALSINDEX);

  return lua_obj();
 }

 // Tinker Call
 template<typename RVal>
 RVal call(const char* name)
 {
  lua_State *L = lua_state::L();

  lua_pushcclosure(L, _exception, 0);
  lua_pushstring(L, name);
  lua_gettable(L, LUA_GLOBALSINDEX);
  if(lua_isfunction(L,-1))
  {
   lua_pcall(L, 0, ret_<RVal>::value, 1);
  }
  else
  {
   lua_pushfstring(L, "lua_tinker : attempt to call global `%s' (not a function)", name);
   _exception(L);
  }

  lua_remove(L, 1);
  return pop_::invoke<RVal>(L, -1);
 }

 template<typename RVal, typename T1>
 RVal call(const char* name, T1 arg)
 {
  lua_State *L = lua_state::L();

  lua_pushcclosure(L, _exception, 0);
  lua_pushstring(L, name);
  lua_gettable(L, LUA_GLOBALSINDEX);
  push_::invoke(L, arg);
  lua_pcall(L, 1, ret_<RVal>::value, 1);
  lua_remove(L, 1);
  return pop_::invoke<RVal>(L, -1);
 }

 template<typename RVal, typename T1, typename T2>
 RVal call(const char* name, T1 arg1, T2 arg2)
 {
  lua_State *L = lua_state::L();

  lua_pushcclosure(L, _exception, 0);
  lua_pushstring(L, name);
  lua_gettable(L, LUA_GLOBALSINDEX);
  push_::invoke(L, arg1);
  push_::invoke(L, arg2);
  lua_pcall(L, 2, ret_<RVal>::value, 1);
  lua_remove(L, 1);
  return pop_::invoke<RVal>(L, -1);
 }

 template<typename RVal, typename T1, typename T2, typename T3>
 RVal call(const char* name, T1 arg1, T2 arg2, T3 arg3)
 {
  lua_State *L = lua_state::L();

  lua_pushcclosure(L, _exception, 0);
  lua_pushstring(L, name);
  lua_gettable(L, LUA_GLOBALSINDEX);
  push_::invoke(L, arg1);
  push_::invoke(L, arg2);
  push_::invoke(L, arg3);
  lua_pcall(L, 3, ret_<RVal>::value, 1);
  lua_remove(L, 1);
  return pop_::invoke<RVal>(L, -1);
 }

 // Tinker Class
 template<typename T>
 struct class_ : lua_obj
 {
  // initialize
  class_(const char* name)
  : m_L(lua_state::L())
  {
   _name(name);

   lua_pushstring(m_L, name);
   lua_newtable(m_L);

   lua_pushstring(m_L, "__name");
   lua_pushstring(m_L, name);
   lua_rawset(m_L, -3);

   lua_pushstring(m_L, "__index");
   lua_pushcclosure(m_L, get_var, 0);
   lua_rawset(m_L, -3);

   lua_pushstring(m_L, "__newindex");
   lua_pushcclosure(m_L, set_var, 0);
   lua_rawset(m_L, -3);

   lua_pushstring(m_L, "__gc");
   lua_pushcclosure(m_L, destroyer<T>::invoke, 0);
   lua_rawset(m_L, -3);

   lua_settable(m_L, LUA_GLOBALSINDEX);
  }

  // constructor
  template<typename CONSTRUCTOR>
  class_<T>& def(CONSTRUCTOR)
  {
   class_<class_type<T>::type>::push_meta(m_L);

   lua_newtable(m_L);
   lua_pushstring(m_L, "__call");
   lua_pushcclosure(m_L, creator<T>::invoke<CONSTRUCTOR>, 0);
   lua_rawset(m_L, -3);
   lua_setmetatable(m_L, -2);
   lua_pop(m_L,1);
   return *this;
  }

  // inheritence
  template<typename P>
  class_<T>& inh()
  {
   class_<class_type<T>::type>::push_meta(m_L);
   lua_pushstring(m_L, "__parent");
   class_<class_type<P>::type>::push_meta(m_L);
   lua_rawset(m_L, -3);
   lua_pop(m_L,1);
   return *this;
  }

  // functions
  template<typename F>
  class_<T>& def(const char* name, F func)
  {
   class_<class_type<T>::type>::push_meta(m_L);

   lua_pushstring(m_L, name);
   new(lua_newuserdata(m_L,sizeof(F))) F(func);
   push_func(m_L, func);
   lua_rawset(m_L, -3);

   lua_pop(m_L,1);
   return *this;
  }

  // variables
  template<typename BASE, typename VAR>
  class_<T>& def_readwrite(const char* name, VAR BASE::*val)
  {
   class_<class_type<T>::type>::push_meta(m_L);

   lua_pushstring(m_L, name);
   new(lua_newuserdata(m_L,sizeof(mem_var<BASE,VAR>))) mem_var<BASE,VAR>(val);
   lua_rawset(m_L, -3);

   lua_pop(m_L,1);
   return *this;
  }

  // metatable
  static void push_meta(lua_State *L)
  {
   const char* name = _name();
   if(name[0])
   {
    lua_pushstring(L, name);
    lua_gettable(L, LUA_GLOBALSINDEX);
   }
   else
   {
    lua_pushnil(L);
   }
  }

  // global name
  static const char* _name(const char* name = NULL)
  {
   static char temp[256] = "";
   if(name) strcpy(temp, name);
   return temp;
  }

  lua_State* m_L;    
 };

} // namespace lua_tinker

#endif //_LUA_TINKER_H_

 

// Lua Test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "lua_tinker/lua_tinker.h"

struct A
{
 A(int v) : value(v) {}
 int value;
};

struct base
{
 base() {}

 const char* is_base(){ return "this is base"; }
};

class test : public base
{
public:
 test(int val) : _test(val) {}
 ~test() {}

 const char* is_test(){ return "this is test"; }

 void ret_void() {}
 int ret_int()    { return _test;   }
 int ret_mul(int m) const { return _test * m;  }
 A get()      { return A(_test);  }
 void set(A a)    { _test = a.value;  }

 int _test;
};

test g_test(11);

class parent : public lua_tinker::lua_value
{
public:
 void to_lua(lua_State* L) { lua_tinker::push_::invoke(L, this); } // lua 肺 傈崔 窃荐

 virtual const char* name() { return "parent"; }

 int m_parent;
};

class child : public parent
{
public:
 void to_lua(lua_State* L) { lua_tinker::push_::invoke(L, this); } // lua 肺 傈崔 窃荐

 const char* name() { return "child"; }

 int m_child;
};

class grandchild : public child
{
public:
 void to_lua(lua_State* L) { lua_tinker::push_::invoke(L, this); } // lua 肺 傈崔 窃荐

 const char* name() { return "grandchild"; }

 int m_grandchild;
};

lua_tinker::lua_value* GetChild(int n)
{
 static parent _parent;
 static child _child;
 static grandchild _grandchild;

 if(n == 0)
  return &_parent;
 else if(n == 1)
  return &_child;
 else
  return &_grandchild;
}

int _tmain(int argc, _TCHAR* argv[])
{
 lua_State* L = lua_open();

 // init Lua
 luaopen_base(L);
 luaopen_string(L);
 luaopen_table(L);

 lua_settop(L, 0);

 // LuaTinker
 lua_tinker::lua_state::open(L);

 lua_tinker::class_<base>("base")
  .def("is_base", &base::is_base)
  ;

 lua_tinker::class_<test>("test")
  .inh<base>()
  .def(lua_tinker::constructor<int>())
  .def("is_test", &test::is_test)
  .def("ret_void", &test::ret_void)
  .def("ret_int", &test::ret_int)
  .def("ret_mul", &test::ret_mul)
  .def("get", &test::get)
  .def("set", &test::set)
  .def_readwrite("_test", &test::_test)
  ;
 lua_tinker::decl("g_test", &g_test);

 lua_tinker::class_<parent>("parent")
  .def("name", &parent::name)
  .def_readwrite("m_parent", &parent::m_parent)
  ;

 lua_tinker::class_<child>("child")
  .inh<parent>()
  .def_readwrite("m_child", &child::m_child)
  ;

 lua_tinker::class_<grandchild>("grandchild")
  .inh<child>()
  .def_readwrite("m_grandchild", &grandchild::m_grandchild)
  ;

 lua_tinker::def("GetChild", GetChild);


 // lua_tinker 龋免 抛胶飘
 lua_tinker::dofile(L, "test.lua");

 lua_tinker::call<void>("print", "-------------------------- call<>");
 lua_tinker::call<void>("dir", g_test);
 lua_tinker::call<void>("print", "-------------------------- call<> finished");

 char temp[1024];
 while(true)
 {
  printf(">");
  if(stricmp(gets(temp), "quit") == 0)
   break;
  lua_tinker::dostring(L, temp);
 }

 // close Lua
 lua_close(L);

 return 0;
}

 

luatinkerE:LUA到C ++绑定库“ lua_tinker”的扩展适用于c ++ 1114和lua 5.3 立即下载

相关推荐

luatinker:lua_tinker for Lua 5.3

Luatinker 适用于lua5.3的luatinker

LuaTinker: 探索Lua编程的全新可能性

LuaTinker: 探索Lua编程的全新可能性 LuaTinker是一个基于LuaJIT的轻量级游戏引擎,专为快速开发高质量的游戏应用而设计。它的主要目标是提供一个简单易用、高效且功能强大的框架,帮助开发者轻松实现他们的游戏创意。 什么是LuaTinker? LuaTinker是一个开源的游戏引擎,它使用Lua脚本语言作为主要编程工具,并充分利用了LuaJIT的高性能特性。该引擎的设计理念是让开...

gitblog_00079的博客 413

lua_tinker支持最新Lua5.2

lua_tinker支持最新Lua5.2 自带6个事例,另外外加VS2005的lua静态LIB标准库。发布时不用跟随Lua.dll。

luatinker 的使用

LuaTinker的作者是Kwon-il Lee韩国人写的,最新的版本是0.2.C,这个C++ wrapper For Lua能够方便和 快捷与C/C++通信,LuaTinker参考了luabind和luaplus的特征写的,虽然没有bindlua和luaplus这本强大 和提供很多功能,LuaTinker的实现只有两个文件,但是LuaTinker提供的基本能够满足大部的要求,用户 还可以对

在梦中享一刻静谧,等待梦中的你 3882

lua_tinker 非常好用的lua的简单封装

非常好用的lua封装,支持类注册,只有两个文件.嵌套lua到工程的利器,并且对现有工程修改最小,使用最方便.

lua_tinker改进版

lua_tinker的改进版,支持lua5.1.4+lua5.2.2

luatinker 的移植

最近在做老项目的移植测试,项目用的lua5.02版本有点老,收了个最新的5.14装上发现用法有不少更新变了,导致老项目上的封装有些用不上了。原来的封装主要是面向过程的,实现上以给lua提供c函数为主,想了想现在与其重写封装不如搜个现有面向对象的用。网上倒是对tolua++和luatinker有不少讨论,争论焦点是luatinker更傻瓜但因为用了不少c++写法不太好移植。去luatinker官网上看却写着for gcc 利用lua的makefile修改,尝试把luatinker插入到基础的lua库中# ma

DDR的专栏 3295

Lua-C 绑定库LuatinkerE.zip

LuatinkerELua-C 绑定库"lua_tinker"的C 14和Lua 5.3扩展版本。使用大量C 14特性Variadic Template 和 index_sequence, SFINAE enable_if 和 type_traits, tuple, function, forward_ref, decltype(auto)。通过vc2015,gcc5.0,clang3.6编译new feature 新特性一览:导入lua的函数,现在支持任意多的参数支持的read/push的元素类型增加std::string,std::function,lua_function_ref,stl容器,std::shared_ptr对象支持最多16个参数的非精确匹配的函数重载(c 类型downcast到lua类型后生成签名), 支持普通函数、类成员函数、构造函数支持函数默认参数及带默认参数的重载函数的匹配移除int64相关函数,使用lua5.3的luaInterager来替代支持调用lua函数时返回多个返回值用tuple包裹支持通过宏定义打开类型一致性检查和常量类成员函数检查支持通过宏定义允许已注册的shared_ptr对象调用类成员函数支持类静态函数注册支持类静态变量注册支持property注册支持继承多个父类,查找时根据顺序依次查找,深度优先支持注册namespace及内的函数/变量/枚举/类支持注册嵌套的类支持在lua中扩展已经注册的类支持在lua中注册一个新类继承已经注册的类 标签:LuatinkerE

LuaTinker的bug和缺陷

LuaTinker的bug和缺陷 LuaTinker是一套还不错的C++代码和Lua代码的绑定库,作者是韩国人Kwon-il Lee,作者应该是参考了LuaBind后,为了简化和避免过重而实现的。其官网在http://gpgstudy.com/gpgiki/LuaTinker ,但可惜全部是韩文的,而最新的代码可以在Git上下载,https://github.com/zupet/LuaTin

C++是促进脑死亡的最佳方式 6693

告别手动点鼠标:用Python脚本批量跑ADS版图仿真,效率提升10倍(附完整代码)

本文详细介绍了如何利用Python脚本自动化ADS版图仿真流程,显著提升射频工程师的工作效率。通过调用ADS底层接口,实现参数化修改、批量任务调度和结果自动收集,解决了手动操作中的常见问题,如仿真不更新等。附完整代码,帮助开发者快速实现10倍效率提升。

weixin_42523543的博客 343

别再折腾框架了!用华为应用市场官方渠道搞定GBOX,安全安装谷歌全家桶(鸿蒙HarmonyOS 3/4实测)

本文详细介绍了如何在鸿蒙系统上通过华为应用市场官方渠道安全安装GBOX,实现谷歌全家桶的无损使用。该方法避免了传统破解方式的安全风险,利用沙箱技术隔离运行环境,确保系统稳定性和数据安全。特别适合鸿蒙HarmonyOS 3/4用户安全使用谷歌生态应用。

weixin_29305313的博客 5033

luatinker 常用函数说明

uatinker 提供的 lua与 C++ 函数的相关接口函数 ,这样便可以屏蔽底层函数,大大提升了了开发效率,但是luatinker是韩国人写的 所以函数的说明是韩文的,所以我把经常用到函数的功能写下了,方便新手使用 lua_State *l= lua_open() 建立lua栈用于和C交互 luaopen_base(lua_State*L) 打开基本函数库  lua_tinke

在梦中享一刻静谧,等待梦中的你 2696

山石网科Hillstone防火墙基础上网配置_CLI命令行(最新版)

山石网科Hillstone防火墙安全网关基础上网基础网络配置_CLI命令行(最新版)

路与肥的博客 1万+

一个实而不华的LuaTinker(1)

LuaTinker的作者是Kwon-il Lee韩国人写的,最新的版本是0.2.C,这个C++ wrapper For Lua能够方便和快捷与C/C++通信,LuaTinker参考了luabind和luaplus的特征写的,虽然没有bindlua和luaplus这本强大和提供很多功能,LuaTinker的实现只有两个文件,但是LuaTinker提供的基本能够满足大部的要求,用户还可以对

Terry的专栏 9333

手把手教学|用飞书+扣子工作流实现自动化批量图片生成,效率提升99%!体验完整操作流程

在先前的文章中,我们已经深入探讨了扣子智能体的多种应用场景,以及如何创建和使用工作流进行高效管理。本文将引领大家通过一个具体案例,将扣子的工作流功能嵌入飞书应用中,实现操作的自动化与高效化。

weixin_66485800的博客 6034

软件破解逆向安全(一)初识内存地址和偏移

工具:CE 内存:数字->存访在电脑中->内存 实例:如何修改植物大战僵尸阳光 内存搜索最核心:过滤数据 先用CE加载植物大战僵尸,如下图 我们可以看到目前我们的阳光数是50,我们尝试在ce里搜索精确数值,4 byte是int整数的表示。 我们发现有很多数据,尝试收集一个阳光变成75再次搜索: 我们发现就一个了,这时我们可以双击Value随便修改阳光的数值了。 这里我们说一下动态和静态地址 动态地址:临时用于存放数据的地址,黑色。特征:重新启动游戏地..

weixin_43781139的博客 2600

c++ 封装luatinker

闲来无聊,把luatinker封装了一层,效果还不错,哈哈。。。。。

在梦中享一刻静谧,等待梦中的你 2322

Spark入门:从零到能跑的实战教程

Spark 的强大在于它统一了大数据处理的多种场景,从批处理到流处理,从 SQL 到机器学习。对于初学者来说,理解 Spark 的核心理念——内存计算和分布式抽象,是最重要的一步。接着,学会用 PySpark 搭建环境,能读数据、能写 SQL,基本上就入门了。剩下的路,就是通过实战去加深理解。写到这里,相信你对 Spark 已经有了一个比较完整的认识。下一步,不妨自己动手写几个 PySpark 脚本,跑一跑日志数据,或者尝试用 Spark SQL 做一个统计。

Morpheon的博客 1376

LuaTinker向Linux移植成功

        今天我怀着无比激动的心情写这篇博客。LuaTinker以其短小精悍,功能比较强大而广泛地被许多网友及同事所关注。自从我用了LuaTinker后,我就想把它移植到Linux上去,将之写成跨平台的代码。看过LuaTinker的人都知道,LuaTinker短小精悍之处就在于模板的使用,但是其使用的却是VC中所特有的模板写法,许多写法都不能在Linux下编译通过,也就不能在Linux下使用

witton的专栏 2966

双模音频解码器设计:USB+蓝牙LDAC平衡输出方案

音频解码器是数字音频系统中实现数模转换的核心组件,其性能直接决定音质保真度与系统延迟。基于高集成SoC的解码方案通过统一时钟域与片内DSP处理,有效抑制Jitter并简化硬件拓扑;结合全平衡模拟输出架构,可显著提升共模抑制比(CMRR)与信噪比(SNR)。该技术路径广泛应用于便携式Hi-Res音频设备、USB-C小尾巴DAC及蓝牙高解析耳机放大器等场景。本文围绕ES9038Q2M双模SoC展开,详解其在LDAC协议支持、UAC2.0兼容性及平衡电流型DAC输出方面的工程实现,为高性能、可量产音频硬件开发提供

weixin_42613018的博客 392

【C# + HALCON 机器视觉】HALCON经典算子:光流法运动分析(optical_flow_mg)

摘要:本文面向智能监控人流统计需求,研究C#与HALCON集成开发中optical_flow_mg算子的应用。通过RTSP获取视频流,利用光流法计算运动矢量,结合形态学操作与区域筛选实现行人区域分割,最终完成人流量统计与热力图可视化。详细阐述ROI局部处理等性能优化策略、try-catch异常捕获机制及跨平台集成方案。实验表明,该系统检测准确率达93.6%,单帧处理时间42ms,为公共场所人流量统计提供了完整可行的技术方案。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 1450

LuaTinker问题

LuaTinker是一套还不错的C++代码和Lua代码的绑定库,作者是韩国人Kwon-il Lee,作者应该是参考了LuaBind后,为了简化和避免过重而实现的。其官网在http://gpgstudy.com/gpgiki/LuaTinker ,但可惜全部是韩文的,而最新的代码可以在Git上下载,https://github.com/zupet/LuaTinker 。对比LuaBind,LuaPl...

MyObject-C的专栏 320

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

LuaTinker 使用

LuaTinker的作者是Kwon-il Lee韩国人写的,最新的版本是0.2.C,这个C++ wrapper For Lua能够方便和 快捷与C/C++通信,LuaTinker参考了luabind和luaplus的特征写的,虽然没有bindlua和luaplus这本强大 和

1431

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

LuaTinker:清晰简单的lua的封装.及其中的陷阱

Lua有很多封装.其中的利弊已经有不少介绍.只是提一下luaplus.本来期望值蛮高的.但后来发现文档质量不高.sample编译不过去.不过调试功能做的比较强..最后选择了LuaTinker.一个韩国人写的.2个文件.5个sample.简单清晰.赞一个.~   首先试验了几个基本功能.都没什么问题. 当时比较疑惑的几个问题是.在lua中可以使用指针么?可以使用c++中的数据

ainn_pp的专栏 5754

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

上一篇: LuaPlus是Lua的C++增强
下一篇: tolua++简介
killwd
博客等级 码龄26年 24粉丝 12原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址