Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyEvent() constructor now can also take a code and a modifier #321

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

fxliang
Copy link
Contributor

@fxliang fxliang commented Mar 5, 2024

No description provided.

@shewer
Copy link
Contributor

shewer commented Mar 5, 2024

可以綁在一起嗎

int raw_make(lua_State *L) {
   an<T> res; // nil
   int n = lua_gettop(L);  
   if ( n == 1 )
       res =  New<T>(string(lua_tostring(L, 1));
    else if (n > 1)
       res = New<T>( lua_tointeger(L, 1), lua_tointeger(L, 2));
  
     LuaType<an<T>>::pushdata(L, res);
     return 1;
 }

KeyEvent( string)
KeyEvent( int code, int modifier)

@fxliang
Copy link
Contributor Author

fxliang commented Mar 6, 2024

可以綁在一起嗎

int raw_make(lua_State *L) {
   an<T> res; // nil
   int n = lua_gettop(L);  
   if ( n == 1 )
       res =  New<T>(string(lua_tostring(L, 1));
    else if (n > 1)
       res = New<T>( lua_tointeger(L, 1), lua_tointeger(L, 2));
  
     LuaType<an<T>>::pushdata(L, res);
     return 1;
 }

KeyEvent( string) KeyEvent( int code, int modifier)

试了不行

@shewer
Copy link
Contributor

shewer commented Mar 6, 2024

我試可以的 , KeyEvent 要重定義

  int raw_make(lua_State *L) {
    an<T> res;
    int n = lua_gettop(L);
    if (n == 1)
      res = New<T>( string(lua_tostring(L, 1)) );
    else if (n > 1)
      res = New<T>(lua_tointeger(L, 1), lua_tointeger(L, 2));

    LuaType<an<T>>::pushdata(L, res);
    return 1;
  }

  static const luaL_Reg funcs[] = {
    { "KeyEvent", raw_make},
    { NULL, NULL },
  };

image

@fxliang
Copy link
Contributor Author

fxliang commented Mar 6, 2024

原来是我打开方式不对(加了WRAP...)

@fxliang fxliang changed the title new interface KeyEventOverload to make KeyEvent by code and modifier KeyEvent() constructor now can also takes a code and a modifier Mar 6, 2024
@fxliang fxliang changed the title KeyEvent() constructor now can also takes a code and a modifier KeyEvent() constructor now can also take a code and a modifier Mar 6, 2024
@hchunhui hchunhui merged commit 20ddea9 into hchunhui:master Mar 8, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants