lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sorry for my poorly english, I just try to report my problem when using the latest luajit. This is first time I post here, hope your guys can understand it.

Demo code as loading lua51.dll by dllcall.

    handle := DllCall("LoadLibrary", "Str","lua51.dll")

    L := DllCall("lua51\luaL_newstate","Cdecl")

    DllCall("lua51\luaL_openlibs", "Ptr", L,"Cdecl")

    DllCall("lua51\luaL_loadfile", "Ptr", L,"AStr", "main.lua", "Cdecl Int")

    DllCall("lua51\lua_pcall", "Ptr", L,"Int", 0, "Int", 0, "Ptr", 0, "Cdecl")

    /* we want to close it now*/

    DllCall("lua51\lua_close", "Ptr", L,"Cdecl")

    DllCall("FreeLibrary", "Ptr", handle )

    /* The lua51.dll is still in use in latest luajit(in win7 s p1 and xp sp3)*/

The content of Main.lua is:

    require "sth"    -- require sth.lua, thiscause the problem. No matter what thecontent of sth.lua, even is empty.

    require "ffi"  -- no problem when we load internal lib.

About table.concat, It just broken recently, I still use the 10.14 version with no problem.

    local concat = table.concat

    function tableToJson (s, ic)

        if not ic and type(s) ~= "table" then return s end

        local l = {}

        for k, v in pairs(s) do

            if type(v) == "table" then

               &n bsp;l[#l+1] = k .. ":".. tableToJson (v, true)

            else

                l[#l+1] = k .. ':"' .. tostring(v) ..'"'

            end

        end

        if #l>0 then

            return "{" .. concat(l, ",") .. "}"

        else

            return "{}"

        end

    end

This function may generate truncated result in some situation, and stop me from using the latest git-head version.