LuaInterface.LuaDLL.lua_pushlstring C# (CSharp) Method

lua_pushlstring() public static method

public static lua_pushlstring ( IntPtr luaState, byte str, int size ) : void
luaState System.IntPtr
str byte
size int
return void
        public static void lua_pushlstring(IntPtr luaState, byte[] str, int size)
        {
            LuaDLLWrapper.luaS_pushlstring(luaState, str, size);
        }

Usage Example

示例#1
0
        static int BufferToString(IntPtr L)
        {
            try
            {
                object o = CheckObject(L, 1);

                if (o is byte[])
                {
                    byte[] buff = (byte[])o;
                    LuaDLL.lua_pushlstring(L, buff, buff.Length);
                }
                else if (o is char[])
                {
                    byte[] buff = System.Text.Encoding.UTF8.GetBytes((char[])o);
                    LuaDLL.lua_pushlstring(L, buff, buff.Length);
                }
                else if (o is string)
                {
                    LuaDLL.lua_pushstring(L, (string)o);
                }
                else
                {
                    LuaDLL.luaL_typerror(L, 1, "byte[] or char[]");
                }
            }
            catch (Exception e)
            {
                LuaDLL.toluaL_exception(L, e);
            }

            return(1);
        }
All Usage Examples Of LuaInterface.LuaDLL::lua_pushlstring
LuaDLL