From 45a73ff68eccd5fc9a3d8ab29b33bee90c9b1e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Tue, 17 Jan 2017 16:22:30 +0100 Subject: [PATCH] Lua: make chunk:mark() call string.format() --- hex.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hex.c b/hex.c index 5688085..992fc72 100644 --- a/hex.c +++ b/hex.c @@ -1006,7 +1006,11 @@ static int app_lua_chunk_mark (lua_State *L) { struct app_lua_chunk *self = luaL_checkudata (L, 1, XLUA_CHUNK_METATABLE); - app_lua_mark (self->offset, self->len, luaL_checkstring (L, 2)); + int n_args = lua_gettop (L); + lua_rawgeti (L, LUA_REGISTRYINDEX, g_ctx.ref_format); + lua_insert (L, 2); + lua_call (L, n_args - 1, 1); + app_lua_mark (self->offset, self->len, luaL_checkstring (L, -1)); return 0; }