Advertisement
losinggeneration

OOLua 2.0.0 beta

Aug 6th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. $ g++ -shared -o tst.so tst.cpp -loolua
  3. $ lua5.1 -ltst
  4. lua5.1: attempt to index a nil value
  5. stack traceback:
  6.         [C]: ?
  7.         [C]: ?
  8.         [C]: ?
  9. */
  10. #include "oolua/oolua.h"
  11.  
  12. typedef struct {
  13.     int x, y;
  14. } point;
  15.  
  16. OOLUA_PROXY(point)
  17.     OOLUA_MGET_MSET(x)
  18.     OOLUA_MGET_MSET(y)
  19. OOLUA_PROXY_END
  20.  
  21. OOLUA_EXPORT_FUNCTIONS(point, set_x, set_y)
  22. OOLUA_EXPORT_FUNCTIONS_CONST(point, get_x, get_y)
  23.  
  24. extern "C" int luaopen_tst(lua_State *L) {
  25.     OOLUA::setup_user_lua_state(L);
  26.     OOLUA::register_class<point>(L);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement