Code Monkey home page Code Monkey logo

Comments (3)

Zhaoyy avatar Zhaoyy commented on May 19, 2024

OC不懂,但是你可以参考Java:

public int luaFunc(int num) {
    LuaValue func = globals.get("luaFunc");

    if (!func.isnil()) {
      try {
        return func.call(CoerceJavaToLua.coerce(num)).toint();
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      System.out.println("func not found");
    }
    return 0;
  }

from luaviewsdk.

dongxicheng avatar dongxicheng commented on May 19, 2024

LView.h头文件里面定义的两个API:
// 调用lua定义的全局函数,functionName:函数名; args:参数队列
-(NSString_) callLua:(NSString_) functionName args:(NSArray_) args;
或者:
// 获取lua定义的全局函数,name:函数名
-(LVBlock_) getLuaBlock:(NSString*) name;
这几个API暂时 IOS和安卓都不兼容,建议如果不是特殊情况不要使用

from luaviewsdk.

Hero2000 avatar Hero2000 commented on May 19, 2024

UIView+LuaView.h 里的

  • (void) lv_callLuaByKey1:(NSString*) key1;
    貌似也可以

    if( self.lv.l ) {
    lv_checkStack32(self.lv.l);
    [self.lv lv_callLuaByKey1:@"calllua"];
    }

window.callback{
calllua = function()
print("calllua ~~~~~~~~");
end,
};

我试了一下 也可以

from luaviewsdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.