lua-users home
lua-l archive

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

On 07/15/2011 05:48 PM, James McKaskill wrote:

OSX and windows x64 support are almost done, but I currently have no way of
building and/or testing them.

Currently only dll builds are supported (ie no static).

Runs with both Lua 5.1 and Lua 5.2 beta.

But (as is) it needs 5.1 to compile, because of this function.

-- Evaluate condition with a Lua expression. Substitutions already performed.
    local function cond_eval(cond)
      local func, err = loadstring("return "..cond)
      if func then
setfenv(func, {}) -- No globals. All unknown identifiers evaluate to nil.
      -- rest of function omitted for brevity

You need something like this

    function loadin(source, env)
      if setfenv then
        local func, err = loadstring(source)
        if func then
          setfenv(func, env)
        return func, err
      return load(source, nil, nil, env)

- tom