RawObjectTest.cs 844 B

123456789101112131415161718192021222324252627282930
  1. using UnityEngine;
  2. using XLua;
  3. namespace XLuaTest
  4. {
  5. public class RawObjectTest : MonoBehaviour
  6. {
  7. public static void PrintType(object o)
  8. {
  9. Debug.Log("type:" + o.GetType() + ", value:" + o);
  10. }
  11. // Use this for initialization
  12. void Start()
  13. {
  14. LuaEnv luaenv = new LuaEnv();
  15. //直接传1234到一个object参数,xLua将选择能保留最大精度的long来传递
  16. luaenv.DoString("CS.XLuaTest.RawObjectTest.PrintType(1234)");
  17. //通过一个继承RawObject的类,能实现指明以一个int来传递
  18. luaenv.DoString("CS.XLuaTest.RawObjectTest.PrintType(CS.XLua.Cast.Int32(1234))");
  19. luaenv.Dispose();
  20. }
  21. // Update is called once per frame
  22. void Update()
  23. {
  24. }
  25. }
  26. }