Pull in new Fennel compiler; tell it to correlate line numbers.
This commit is contained in:
Submodule 3rd-party updated: 1829881440...fa4a9f2ae3
22
src/luaapi.c
22
src/luaapi.c
@@ -1620,10 +1620,8 @@ const tic_script_config* getMoonScriptConfig()
|
|||||||
#define FENNEL_CODE(...) #__VA_ARGS__
|
#define FENNEL_CODE(...) #__VA_ARGS__
|
||||||
|
|
||||||
static const char* execute_fennel_src = FENNEL_CODE(
|
static const char* execute_fennel_src = FENNEL_CODE(
|
||||||
local ok, val = pcall(require('fennel').eval, ...)
|
local ok, msg = pcall(require('fennel').eval, ..., {filename="game", correlate=true})
|
||||||
-- allow you to return a function instead of setting TIC global
|
if(not ok) then return msg end
|
||||||
if(not TIC and type(val) == "function") then TIC = val end
|
|
||||||
return val
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static bool initFennel(tic_mem* tic, const char* code)
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1673,15 +1671,13 @@ static bool initFennel(tic_mem* tic, const char* code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lua_pushstring(fennel, code);
|
lua_pushstring(fennel, code);
|
||||||
if (lua_pcall(fennel, 1, 1, 0) != LUA_OK)
|
lua_call(fennel, 1, 1);
|
||||||
{
|
const char* err = lua_tostring(fennel, -1);
|
||||||
const char* msg = 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 false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user