ceres-wc3 / ceres

MIT License
34 stars 8 forks source link

Build fail #21

Open DoctorRyner opened 4 years ago

DoctorRyner commented 4 years ago

build.zip

Hi. When I put this to src and rename Main.lua to main.lua I get:

=> main λ (~/tmp/purescript/ps-to-lua-test/ceres) = ceres build -- --map WorldEditTestMap.w3x
> Received build command
>     Input: WorldEditTestMap.w3x
>     Retain map script: true
>     Output type: mpq
> Loaded map WorldEditTestMap.w3x
> WARN: Could not extract script from map WorldEditTestMap.w3x: File not found
> WARN: Map script won't be included in the final artifact
> Building without including original map script
> ERR: Map build failed:
> Could not compile module [castl.constructor.error.error] ("src/castl/constructor/error/error.lua"):
Cyclical dependency found involving module castl.internal

But when I use original Lua interpreter, it works fine

=> main λ (~/tmp/purescript/ps-to-lua-test/ceres/src) = lua main.lua
Power of PureScript!

Is it possible to make it work?

I use http://www.purescript.org as a scripting language

It compiles to JavaScript and then I use https://github.com/PaulBernier/castl to compile it from JavaScript to Lua. castl/ directory comes from lua/castl in the previously mentioned repository and it contains runtime for JavaScript

DoctorRyner commented 4 years ago

Also when I used http://siffiejoe.github.io/lua-amalg/ to bundle it in a single file it throws this error:

main.lua.zip

=> main λ (~/tmp/purescript/ps-to-lua-test/ceres) = ceres build -- --map WorldEditTestMap.w3x
> Received build command
>     Input: WorldEditTestMap.w3x
>     Retain map script: true
>     Output type: mpq
> Loaded map WorldEditTestMap.w3x
> WARN: Could not extract script from map WorldEditTestMap.w3x: File not found
> WARN: Map script won't be included in the final artifact
> Building without including original map script
> ERR: Map build failed:
> Could not compile module [main] ("src/main.lua"):
Could not parse file:
    --> 3366:11
     |
3366 |     local local_UTC_offset_sec = difftime(time(date("!*t", now)), time(date("*t", now)))␊
     |           ^---
     |
     = expected Ident
ElusiveMori commented 4 years ago

I'm not really sure whether pure Lua even supports cyclic dependencies (maybe when the module doesn't return any result it is ok?), but in general there is no nice way of solving circular dependencies in a language like Lua.

The second issue seems to be down to a parser error. I'll look into fixing it.

DoctorRyner commented 4 years ago

Well, Lua's interpreter is able to run my code from CLI

ElusiveMori commented 4 years ago

If that's the case, then I might lift the restriction on cyclic dependencies. I'll look into it.