Code Monkey home page Code Monkey logo

unilua's Introduction

UniLua

A pure C# implementation of Lua 5.2 focus on compatibility with Unity3D.

UniLua是一个纯C#的Lua 5.2实现,专注于与Unity3D的兼容性。

一些补充说明

UniLua 主要关注的还是对 lua 本身的实现,而不是怎么把 Unity3D 引擎提供的功能都引入到 lua 里。

从 lua 调用 C# 函数不建议使用 FFI 库(虽然示例工程里用了,看起来方便,但是并不完善,效率也不好)。建议参考 从 Lua 调用 C# 函数 ( Calling C# funcitons from Lua ) 来自己实现封装函数。

示例工程 ( Sample Project )

To demonstrate the basic use of UniLua, a sample project is included.
Open Assets\Stages\GameMain.unity with Unity3D, and just click the "Play" button.
An icon will appear in the screen, and you can move it around with WSAD keys.

项目中包含了一个微型的示例工程,用来演示 UniLua 的基本使用。
用 Unity3D 打开 Assets\Stages\GameMain.unity 然后直接点击播放按钮运行。
屏幕上会显示一个小图标,你可以用 WSAD 键控制它四处移动。

开发状况 ( Development Status )

  • 基本特性 ( Basic features )

    • 所有 Lua 的基本语言特性都已实现,包括协程元表,并且与 Lua5.2 标准实现一致。部分 GC 相关的元方法如 __gc__mode 未实现
      ( All language features are implemented exactly the same as the standard Lua 5.2, including coroutine and metatable, except some GC-related metamethods like __gc and __mode. )
  • 内置库 ( Libraries )

    • Base lib: done
    • Package lib: done
    • Coroutine lib: done
    • Table lib: done
    • IO lib: not implemented
      • 因为暂时没有需求 ( not needed in our games right now )
    • OS lib: not implemented
      • 因为暂时没有需求 ( not needed in our games right now )
    • String lib: partially implemented
      • 因为暂时没有需求 ( not needed in our games right now )
    • Debug lib: partially implemented
      • 勉强够用了 ( barely enough )
  • 额外实现的库 ( Additional Libraries )

    • FFI lib: basicly done
      • 实验性质,不建议在要求性能的环境下使用 ( experimental. not suggested to use in performance-critical situation )
    • Encoding lib: basicly done
      • 支持在 UTF-8 编码和 UTF-16 编码间进行转换 ( support convert between UTF-8 and UTF-16 )
  • TODO

    • Complete string lib.
    • Complete debug lib.
  • 已知的问题 ( Known Issues )

    • Metamethod '__gc' will not working.
      • 因为没有自己实现GC机制,而是依赖于C#的GC ( for directly depending on C#'s GC mechanism )
    • Weak tables is not supported: '__mode' will not working.
      • 原因同上 ( the same reason mentioned above )
    • full userdata is not supported

SciMark

test on Unity3D 4.3.1, Windows 7, Intel i5-3470

  • FFT 1.07 [1024]
  • SOR 2.51 [100]
  • MC 0.66
  • SPARSE 1.59 [1000, 5000]
  • LU 1.84 [100]
  • SciMark 1.53 [small problem sizes]

常用链接 ( Links )##

unilua's People

Contributors

chexiongsheng avatar fum1h1ro avatar xebecnan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unilua's Issues

Support for Enum definitions...

In unity_engine.lua:_init(_ENV) You can define unity enums as a class and pass objects around of the enum types ("LighType","TouchPhase" comes into mind) however cannot adress each of the enumerators( In the case of of Touchphase: Began Moved Stationary Ended ...)

touchObj1.phase == touchObj2.phase --works
touchObj1.phase == TouchPhase.Began --dont work

关于LuaFile

因为对从assetbundle中文件来说,无法用到dofile操作。所以我修改了一下LuaFile将需要FileStream的地方换成了MemoryStream。

目前运行比较正常。不过不知道其他地方是否有隐患。

require的限制

我的工程大部分逻辑都在lua端实现的
里面有很多require文件,今天发现
require的时候手机上崩溃,电脑上不会
查logcat说内存溢出,我大量测试发现
require一个文件内容为Test={},会导致奔溃,而我把require的地方直接换成Test={}。
我更新到最新的unilua也没有,该怎么解决

UliLua stack增长代码的bug

Hi,

unilua中stack 增长的代码,看过之后觉得有一个bug,那就是:程序不能够分配LuaConf.LUAI_MAXSTACK的栈大小空间。源代码如下:
Do.cs:
private void D_GrowStack(int n)
{
int size = Stack.Length;
if(size > LuaConf.LUAI_MAXSTACK)
D_Throw(ThreadStatus.LUA_ERRERR);

        int needed = Top.Index + n + LuaDef.EXTRA_STACK;
        int newsize = 2 * size;
        if(newsize > LuaConf.LUAI_MAXSTACK)
            { newsize = LuaConf.LUAI_MAXSTACK; }
        if(newsize < needed)
            { newsize = needed; }
        if(newsize > LuaConf.LUAI_MAXSTACK)
        {
            D_ReallocStack(ERRORSTACKSIZE);
            G_RunError("stack overflow");
        }
        else
        {
            D_ReallocStack(newsize);
        }
    }

    private void D_ReallocStack(int size)
    {
        Utl.Assert(size < LuaConf.LUAI_MAXSTACK || size == ERRORSTACKSIZE);
        var newStack = new StkId[size];
        int i = 0;
        for( ; i<Stack.Length; ++i) {
            newStack[i] = Stack[i];
            newStack[i].SetList(newStack);
        }
        for( ; i<size; ++i) {
            newStack[i] = new StkId();
            newStack[i].SetList(newStack);
            newStack[i].SetIndex(i);
            newStack[i].V.SetNilValue();
        }
        Top = newStack[Top.Index];
        Stack = newStack;
        StackLast = size - LuaDef.EXTRA_STACK;
    }

这个代码里边,方法D_GrowStack是允许栈分配LUAI_MAXSTACK大小的,但是方法D_ReallocStack却不允许,因为这里
Utl.Assert(size < LuaConf.LUAI_MAXSTACK || size == ERRORSTACKSIZE);
只允许栈小于LUAI_MAXSTACK。

但是当我把这里的小于直接改为小于等于之后,程序一直转菊花,没反应。

所以想确认下,上述代码是否是一个bug,还是我用的unilua版本不对,我用的最新版。

如果这里确实是个bug,能否给一个解决方案。

期待回复!谢谢!

Examples of passing unity objects from c# to lua and lua to c#

Can you provide examples:

  • how a unity object created in lua can be passed to c#

//c#
public static int testfunc( ILuaState lua )
{
GameObject pGameObject = (GameObject)lua.ToUserData( 1 );
Debug.Log("pGameObject.name "+pGameObject.name );
{

-- Lua
local goPlaceholder = GameObject._New("testObject")
testfunc( goPlaceholder )

ERROR

NullReferenceException: Object reference not set to an instance of an object

  • how a unity object created in c# can be passed to lua

Thanks in advance!

Tick rate control

In Lua 5.1 we were able to limit the tick rate with the debug library, but it hasn't been implemented on UniLua. Can you at least implement some functions to control the tick rate/infinite loops/stack overflow?

Ref返回重复的引用编号

各位好,
我在使用 Ref 时碰到这样一个问题, Ref 返回了一个并没有被Unref的整数值, 具体过程是这样的:

...
LuaState<1574979840> --(删):8
LuaState<1574979840> --(删):7
LuaState<1574979840> ++(新):7
LuaState<1574979840> ++(新):8
LuaState<1574979840> ++(新):11
LuaState<1574979840> ++(复):7
LuaState<1574979840> ++(新):12
...

也就是 7 这个数在unref之后, 下一次ref返回了一个不是从freelist中得到的 7, 而后又从freelist得到了另一个7.
我在LuaAuxLib.cs这两个调用中加了3行输出产生了上述日志. 其余均未作任何修改.
我也看了一下原版lua这部分代码, 是完全一样的, 就想不通了.
是不是 Ref/Unref 的调用有什么其他限制?

    public int L_Ref(int t)
    {
        if (API.IsNil(-1))
        {
            API.Pop(1); // remove from stack
            return LuaConstants.LUA_REFNIL; // `nil' has a unique fixed reference
        }

        t = API.AbsIndex(t);
        API.RawGetI(t, FreeList); // get first free element
        int reference = API.ToInteger(-1); // ref = t[freelist]
        API.Pop(1); // remove it from stack
        if (reference != 0) // any free element?
        {
            API.RawGetI(t, reference); // remove it from list
            API.RawSetI(t, FreeList); // t[freelist] = t[ref]
            UnityEngine.Debug.Log("LuaState<" + GetHashCode() + "> ++(复):" + reference);
        }
        else // no free elements
        {
            reference = API.RawLen(t) + 1; // get a new reference
            UnityEngine.Debug.Log("LuaState<" + GetHashCode() + "> ++(新):" + reference);
        }
        API.RawSetI(t, reference);
        return reference;
    }

    public void L_Unref(int t, int reference)
    {
        if (reference >= 0)
        {
            t = API.AbsIndex(t);
            API.RawGetI(t, FreeList);
            API.RawSetI(t, reference); // t[ref] = t[freelist]
            API.PushInteger(reference);
            API.RawSetI(t, FreeList); // t[freelist] = ref
            UnityEngine.Debug.Log("LuaState<" + GetHashCode() + "> --(删):" + reference);
        }
    }

关于PushUInt64函数的使用方式

public static int TestUint64(ILuaState lua)
{
UInt64 ul = 19800000;
lua.PushUInt64( ul ); // 将返回值入栈
return 1; // 有一个返回值
}
请问下,我这样定义个一个测试PushUInt64的全局函数,运行会有问题,其他的PushXXXX函数都没问题,唯独PushUInt64会出问题,不知道是不是使用方式不对呢?

B_LoadFile看不明白

您这是这么写
public static int B_LoadFile( ILuaState lua )
{
string fname = lua.L_OptString( 1, null );
string mode = lua.L_OptString( 2, null );
bool env = ! lua.IsNone( 3 );
var status = lua.L_LoadFileX( fname, mode );
if( status != ThreadStatus.LUA_OK && env )
{
lua.PushValue( 3 );
lua.SetUpvalue( -2, 1 ); // put before error message
return 2;
}
return LoadAux( lua, status );
}
如果按官方的,貌似要这么写
public static int B_LoadFile( ILuaState lua )
{
string fname = lua.L_OptString( 1, null );
string mode = lua.L_OptString( 2, null );
bool env = ! lua.IsNone( 3 );
var status = lua.L_LoadFileX( fname, mode );
if( status == ThreadStatus.LUA_OK && env )
{
lua.PushValue( 3 );
lua.SetUpvalue( -2, 1 ); // put before error message
}
return LoadAux( lua, status );
}

阿楠,C#传递到lua的lightuserdata没有metadata,没法还原成class,我hack了你的代码,你看这样好不好

如果我要用Unilua操作在Scence中已有的对象,就必须把对象传给Unilua。比如我在scene中有个GameObject a, 那么我用Lua.PushLightUserData(a)把东西push到lua里。
lua 函数是这样:
local function DisableButton(a)
a:SetActive(false)
end
这样是不行的,因为a只是一个LightUserData,实际上是一块内存,没有了GameObject的field和method了。而ffi.lua中没有把new_class_mgr暴露出来,造成虽然我可以创建新的Gameobject,但是没法从内存中还原Gameobject。
看了代码后我在resolve_builder()中加了一行
mod.cls_mgr = cls_mgr
把new_class_mgr暴露了出来,才能使用
obj = UnityEngine.cls_mgr.make_instance('GameObject', a)
这样比较丑陋,但是实现了我想要的功能。
请问还有更好的办法吗?

Unable to map Object static functions

unity_engine.lua

class("Object") 
    :static_method("Object Instantiate(Object, Vector3, Quaternion)")   
    :static_method("Object Instantiate(Object)")    
            :static_method("Destroy(Object, float)")

mapping any of this these will give you errors
"
Exception: @lib\ffi.lua:291: Instantiate
LuaScriptController.Awake () (at Assets/Behaviour/LuaScriptController.cs:32)
"
Any way to properly map these (necessary) functions? Thanks in advance!

阿楠你好,请教个关于metatable的问题,可能是个bug

你好,非常感谢你的贡献,我已经在项目中使用上了你的这个库,并做了一些自己的扩展,现在遇到一个问题请教下你,忘指点一二哈。
我自己用c#实现了类似你ffi库的一个扩展模块,主要是利用反射和元表来实现调用c#方法,加入了命名空间和别名的支持等等。我们知道在lua中描述一个c#的对象是用的lightuserdata,并且赋予它一个描述方法成员集合的元表来实现成员访问机制。

代码大概是:
local obj = mgr:getObj()
其中,mgr, obj, getObj,分别是c#的对象和成员方法,两个对象都用userdata加meta table来表示,问题是,经过这个函数的调用后,mgr的元表变成了函数返回值对象类型的元表!!!
导致,后面mgr对象不可使用了。

阿楠兄,看看能否帮我想想这是什么原因造成的,或者给我指几个关键代码片段,我去跟踪下。或者我也能把我写的代码发给你看看。

非常期待您的消息,再次感谢你的出色工作!!

在u3d 4.2.1中UniLua.ILuaState 报错

Assets/UniLua/LuaStrLib.cs(806,31): error CS1061: Type UniLua.ILuaState' does not contain a definition forGetTable' and no extension method GetTable' of typeUniLua.ILuaState' could be found (are you missing a using directive or an assembly reference?)

The FFI library

Hello, UniLua has most of the standard libraries from Lua (they're understandable because it's documentation can be found on lua.org), but the FFI library used in UniLua is quite different from LuaFFI, can you provide some documentation to it or at least some examples of the usage?

IOS Full-AOT 问题

使用unilua在ios下跑报错了,如下:
Attempting to JIT compile method ‘UniLua.LuaState:L_Opt(UniLua.OptFuncDelegate`1, int, int)’ while running with –aot-only.

是否遇到过这个问题?是我的代码需要改动么?
感谢。

场景跳转崩溃

项目里用unilua去调用c#的接口利用NGUI创建UI,但是有的时候,会发生跳转的时候整个工程崩溃的情况,但是利用延迟的方式调用场景跳转(不点击按钮),则没有事。求指教

UnloadTime: 3.072003 ms
System memory in use before: 226.7 MB.
Receiving unhandled NULL exception
Launching bug reporter
Obtained 256 stack frames.
#0 0x00000004655601 in array_safe_grow
#1 0x00000004655abb in array_safe_grow
#2 0x00000004655a3a in array_safe_grow
#3 0x00000004655b42 in array_safe_grow

Lua.Call 完事儿需要Lua.Pop(args.length),不然栈可能溢出??

写了如下一段代码,用于C#调用只有int参数的lua函数。
但是多次调用这个后会提示栈溢出,是不是call之后没有清栈啊?

    /// <summary>
    /// 调用lua函数:函数签名 0个或多个int参数,无返回值。
    /// </summary>
    /// <param name="func">lua函数名</param>
    /// <param name="args">func 的 int类型参数列表</param>
    private void CallLua(string func, params int[] args) {
        _vm.GetGlobal(func);
        if (!_vm.IsFunction(-1)) {
            Debug.LogWarning("lua中无此函数:" + func);
            return;
        }

        for (int i = 0; i < args.Length; i++) {
            _vm.PushInteger(args[i]);
        }
        _vm.Call(args.Length, 0);
        _vm.Pop(args.Length);//必须要加这个,不然可能导致栈溢出?
    }

L_DoString assert failed file:uaTable.cs line:516

execute below code. cause Utl.Assert(nasize/2 <= na && na <= nasize); failed.
for (int i = 0; i < 100000; ++i)
{
pLua.L_DoString("f={"HelloMsg",{123,{age=28,sex="man"},{[1]=1,[2]=2,[3]=3,[4]=4}}}");
}
很奇怪DoString 这段代码会导致 assert 失败,抛出异常。 执行次数不多的时候没问题。
执行次数少的话,有时候失败,有时候没问题。。。
我用C的解析器测试了这段代码,不会出现问题。
能给点指示吗谢谢:)

VS编译错误

错误 1 必须对自动实现的属性“UniLua.Pointer.Index”的支持字段完全赋值,才能将控制返回给调用方。请考虑从构造函数初始值设定项中调用默认构造函数。 E:\Test\UniLua-master\Assets\UniLua\LuaState.cs 42
错误 2 在给“this”对象的所有字段赋值之前,无法使用该对象 E:\Test\UniLua-master\Assets\UniLua\LuaState.cs 45
错误 3 必须对自动实现的属性“UniLua.Pointer.Index”的支持字段完全赋值,才能将控制返回给调用方。请考虑从构造函数初始值设定项中调用默认构造函数。 E:\Test\UniLua-master\Assets\UniLua\LuaState.cs 48
错误 4 在给“this”对象的所有字段赋值之前,无法使用该对象 E:\Test\UniLua-master\Assets\UniLua\LuaState.cs 51

LuaAPI.Replace fails for Upvalues

Hi,

When trying to Replace an Upvalue, NotImplementedException is thrown in StkId because IsolateValue != null.

In addition to my test code, I was able to observe this behavior in the String library LuaStrLib when trying to perform the following with lua

for word in string.gmatch('Hello Lua User', 'ua') do print(word) end

I am running a slightly modified version of the library (Unity removed, plain old C# class library) from git revision 1cf9d7b. That said, I am confident my changes didn't step anywhere this problem.

I am happy to do some work to get this fixed, I just need some direction on what isn't implemented. Some, hopefully, relevant screenshots attached.

Many Thanks,
Bryan

Replicating Code - Microsoft Visual Studio

Exception Location - Microsoft Visual Studio

Call Stack - Microsoft Visual Studio

WHY got the strange strack trace ?!

NullReferenceException: Object reference not set to an instance of an object
UniLua.BytesLoadInfo.PeekByte ()
UniLua.LuaState.F_Load (UniLua.LoadParameter& param)
UniLua.LuaState.D_RawRunProtected[LoadParameter](UniLua.PFuncDelegate1 func, UniLua.LoadParameter& ud) UniLua.LuaState.D_PCall[LoadParameter](UniLua.PFuncDelegate1 func, UniLua.LoadParameter& ud, Int32 oldTopIndex, Int32 errFunc)
UniLua.LuaState.UniLua.ILuaAPI.Load (ILoadInfo loadinfo, System.String name, System.String mode)
UniLua.LuaState.L_LoadBytes (System.Byte[] bytes, System.String name)
UniLua.LuaState.UniLua.ILuaAPI.Call (Int32 numArgs, Int32 numResults)

ILuaAPI.Call does not invoke L_LoadBytes ~~~

Dump文件里面的BuildHeader()问题

写入文件时的字节长度是否跟32/64位机子有关系?各种长度都写死了会不会有问题

实际上我在使用时发现Undump文件里的ReadSizeT()里var ret = BitConverter.ToInt64( bytes, 0 );是会越界的

string.gmatch匹配[^a]时有问题

我这里已经修正了,另外还实现了string.gsub,修正了些webplayer的兼容问题(有些你这没修正的),这些东东要提交吗?

lua_compare 似乎实现存在BUG

你好,

使用lua_compare接口比较两个函数时遇到了一个问题。

调用 lua.compare 时用到了这个函数
VM.CS:1204: private bool V_EqualObject( ref TValue t1, ref TValue t2, bool rawEq )
如果比较的是gcobject,比如lua function,那么执行的是这一句
1241: return System.Object.ReferenceEquals( t1, t2 );
这导致实际没有执行TValue.Equals(object)方法。得到的结果通常会是false。

举例说明,
在C#中实现如下接口
public static int lua_comparetest(Scripting.Lua.ILuaState lua)
{
if (lua.Compare(1, 2, Scripting.Lua.LuaEq.LUA_OPEQ))
Debug.LogWarning("equals");
else
Debug.LogWarning("not equals");
return 0;
}
在Lua中按如下方式调用该函数(假设此接口注册的名字叫compare)
local f = function () end
compare(f, f)
得到的结果将会是not equals

1241行是否可以直接使用 t1.Equals(t2)代替RefEquals避免这个问题?

goto dflt 语句编译不通过

388行 UniLua/LuaStrLib.cs(54,54): Error CS0159: The label `dflt:' could not be found within the scope of the goto statement (CS0159) (Assembly-CSharp)

C#
case '$':
{
if( p+1 == ms.PatternEnd ) // is the `$' the last char in pattern?
return (s == ms.SrcEnd) ? s : -1; // check end of string
else goto dflt; //此行编译不通过,改为 goto default; 后通过
}

unit tests should be added to unilua

unit tests should be added to unilua with 100% code coverage , so that one can be assured by the stability of the tests - when the same unit tests are run on :-
(A) Lua (standard VM)
(B) UniLua
It will ensure better code quality too

Livecoding?

Amazing what you've done so far. Was curious if there's any way to recompile during runtime, if i wanted to do livecoding for instance?

读取luatable的错误

我从lua文件中读取配置到字典中.
class Program
{
static void ReadEntity(ILuaState lua, Dictionary<string, Object> entity)
{
LuaType luaType = lua.Type(-1);
if (!lua.IsTable(-1))
{
return;
}
lua.PushNil();
int index = 0;
while (lua.Next(-2))
{
string name;
LuaType keyType = lua.Type(-2);
LuaType valueType = lua.Type(-1);
if (keyType == LuaType.LUA_TSTRING)
{
name = lua.L_ToString(-2);
}
else
{
name = index.ToString();
}
index++;
switch (valueType)
{
case LuaType.LUA_TBOOLEAN:
bool b = lua.ToBoolean(-1);
entity.Add(name, b);
break;
case LuaType.LUA_TNUMBER:
double number = lua.ToNumber(-1);
entity.Add(name, number);
break;
case LuaType.LUA_TSTRING:
string s = lua.L_ToString(-1);
entity.Add(name, s);
break;
case LuaType.LUA_TTABLE:
Dictionary<string, Object> dic = new Dictionary<string, Object>();
ReadEntity(lua, dic);
entity.Add(name, dic);
break;
default:
break;
}
lua.Pop(1);
}
}

    static void Main(string[] args)
    {
        ILuaState lua = LuaAPI.NewState();

        // 加载基本库
        lua.L_OpenLibs();
        string LuaScriptFile = @"MyStruct.lua";
        ThreadStatus status = lua.L_DoFile(LuaScriptFile);
        if (status != ThreadStatus.LUA_OK)
        {
            Console.WriteLine(status);
            return;
        }
        lua.GetGlobal("Player");
        Dictionary<string, Object> dic = new Dictionary<string, Object>();
        ReadEntity(lua, dic);
        Console.WriteLine(dic);
    }
}

myStruct.lua 如下.
Player={
id =342,
name = '我的名字',
tels = {65545324,2345645};
kv = {tt =34, gp ='ewsadf',add='成都'};
WS = 'ws中文fasd',
CS = 'csfqd',
week = 5
}
结果出现异常.不能读取.
而类似的代码在C/C++中是可以读取的!

tostring 的实现是否有个 bug ?

例如:
local a = 10;
local b = tostring(a);
之后,b 好像还是一个数字,而不是字符串。因为 LuaAuxLib.cs 中的 ToString 函数没有将返回值压栈?

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.