Pull in new Fennel compiler; tell it to correlate line numbers.
This commit is contained in:
parent
bd3d9cfbd7
commit
bae4cfb2ef
|
@ -1 +1 @@
|
|||
Subproject commit 18298814404110bad0aba611bcc901fe6c59a085
|
||||
Subproject commit fa4a9f2ae3d53f3fc5145923e3924e2d53989e5c
|
18
src/luaapi.c
18
src/luaapi.c
|
@ -1620,10 +1620,8 @@ const tic_script_config* getMoonScriptConfig()
|
|||
#define FENNEL_CODE(...) #__VA_ARGS__
|
||||
|
||||
static const char* execute_fennel_src = FENNEL_CODE(
|
||||
local ok, val = pcall(require('fennel').eval, ...)
|
||||
-- allow you to return a function instead of setting TIC global
|
||||
if(not TIC and type(val) == "function") then TIC = val end
|
||||
return val
|
||||
local ok, msg = pcall(require('fennel').eval, ..., {filename="game", correlate=true})
|
||||
if(not ok) then return msg end
|
||||
);
|
||||
|
||||
static bool initFennel(tic_mem* tic, const char* code)
|
||||
|
@ -1660,7 +1658,7 @@ static bool initFennel(tic_mem* tic, const char* code)
|
|||
|
||||
if (luaL_loadbuffer(fennel, (const char *)fennel_lua, fennel_lua_len, "fennel.lua") != LUA_OK)
|
||||
{
|
||||
machine->data->error(machine->data->data, "failed to load fennel.lua");
|
||||
machine->data->error(machine->data->data, "failed to load fennel compiler");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1673,17 +1671,15 @@ static bool initFennel(tic_mem* tic, const char* code)
|
|||
}
|
||||
|
||||
lua_pushstring(fennel, code);
|
||||
if (lua_pcall(fennel, 1, 1, 0) != LUA_OK)
|
||||
{
|
||||
const char* msg = lua_tostring(fennel, -1);
|
||||
lua_call(fennel, 1, 1);
|
||||
const char* err = lua_tostring(fennel, -1);
|
||||
|
||||
if (msg)
|
||||
if (err)
|
||||
{
|
||||
machine->data->error(machine->data->data, msg);
|
||||
machine->data->error(machine->data->data, err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue