diff --git a/src/scripting/game_lua_kernel.cpp b/src/scripting/game_lua_kernel.cpp index cb4900bebbee..0334431e368b 100644 --- a/src/scripting/game_lua_kernel.cpp +++ b/src/scripting/game_lua_kernel.cpp @@ -3300,34 +3300,7 @@ int game_lua_kernel::intf_redraw(lua_State *L) screen.draw(true,true); } return 0; -} - -/** - * Gets the dimension of an image. - * - Arg 1: string. - * - Ret 1: width. - * - Ret 2: height. - */ -static int intf_get_image_size(lua_State *L) -{ - char const *m = luaL_checkstring(L, 1); - image::locator img(m); - if (!img.file_exists()) return 0; - surface s = get_image(img); - lua_pushinteger(L, s->w); - lua_pushinteger(L, s->h); - return 2; -} - -/** - * Returns the time stamp, exactly as [set_variable] time=stamp does. - * - Ret 1: integer - */ -static int intf_get_time_stamp(lua_State *L) -{ - lua_pushinteger(L, SDL_GetTicks()); - return 1; -} +}} /** * Lua frontend to the modify_ai functionality @@ -3957,8 +3930,6 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports { "debug_ai", &intf_debug_ai }, { "eval_conditional", &intf_eval_conditional }, { "get_era", &intf_get_era }, - { "get_image_size", &intf_get_image_size }, - { "get_time_stamp", &intf_get_time_stamp }, { "get_traits", &intf_get_traits }, { "get_viewing_side", &intf_get_viewing_side }, { "modify_ai", &intf_modify_ai_old }, diff --git a/src/scripting/lua_kernel_base.cpp b/src/scripting/lua_kernel_base.cpp index c73f05d7de4f..206a5aa79f45 100644 --- a/src/scripting/lua_kernel_base.cpp +++ b/src/scripting/lua_kernel_base.cpp @@ -276,6 +276,31 @@ int intf_log(lua_State *L) { return 0; } +/** +* Gets the dimension of an image. +* - Arg 1: string. +* - Ret 1: width. +* - Ret 2: height. +*/ +static int intf_get_image_size(lua_State *L) { + char const *m = luaL_checkstring(L, 1); + image::locator img(m); + if(!img.file_exists()) return 0; + surface s = get_image(img); + lua_pushinteger(L, s->w); + lua_pushinteger(L, s->h); + return 2; +} + +/** +* Returns the time stamp, exactly as [set_variable] time=stamp does. +* - Ret 1: integer +*/ +static int intf_get_time_stamp(lua_State *L) { + lua_pushinteger(L, SDL_GetTicks()); + return 1; + + // End Callback implementations // Template which allows to push member functions to the lua kernel base into lua as C functions, using a shim @@ -401,6 +426,8 @@ lua_kernel_base::lua_kernel_base() { "random", &intf_random }, { "wml_matches_filter", &intf_wml_matches_filter }, { "log", &intf_log }, + { "get_image_size", &intf_get_image_size }, + { "get_time_stamp", &intf_get_time_stamp }, { nullptr, nullptr } };