GithubHelp home page GithubHelp logo

Comments (9)

chexiongsheng avatar chexiongsheng commented on May 12, 2024 2

已经增加,文档:https://github.com/Tencent/xLua/blob/master/Assets/XLua/Doc/hotfix.md

from xlua.

chexiongsheng avatar chexiongsheng commented on May 12, 2024

MethodBase关于Invoke的定义:
public object Invoke(object obj, object[] parameters);
public abstract object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture);

下面那个是子类实现的,而反射找到的是子类,里头只有下面那个方法,换言之,按目前xLua的实现你访问MonoMethodInfo实例只能调用到下面那个。

是个问题,但其实也不建议你反射直接在lua里头做,在C#封装一下,提供个更简单的接口给lua更合适些。
类似这样:
public class HotfixUtils
{
public static void SetPrivateField(object obj, string feildName, object val);
。。。
}

稍后我提供一下

from xlua.

chexiongsheng avatar chexiongsheng commented on May 12, 2024

我决定提供一个api,设置一下后,所有private的东东可用。

from xlua.

chexiongsheng avatar chexiongsheng commented on May 12, 2024

设置某类

from xlua.

wzhfantastic avatar wzhfantastic commented on May 12, 2024

原来是这样,谢谢!期待您的更新!

from xlua.

wzhfantastic avatar wzhfantastic commented on May 12, 2024

使用很方便,谢谢!

from xlua.

mydodolookdo avatar mydodolookdo commented on May 12, 2024

xlua.private_accessible(CS.HotfixTest)
把这一句加到lua里面,访问私有函数不会报错,但访问私有变量还是会报错

from xlua.

chexiongsheng avatar chexiongsheng commented on May 12, 2024

@mydodolookdo 我试了ok,代码贴一下?报啥错呢?

from xlua.

mydodolookdo avatar mydodolookdo commented on May 12, 2024

刚才重新生成code编译了之后,没有报错可以访问私有变量了,不好意思。

from xlua.

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.