aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_client.cpp2
-rw-r--r--src/script/lua_api/l_clientobject.cpp117
-rw-r--r--src/script/lua_api/l_clientobject.h13
-rw-r--r--src/script/lua_api/l_localplayer.cpp6
-rw-r--r--src/script/lua_api/l_mainmenu.cpp117
-rw-r--r--src/script/lua_api/l_mainmenu.h2
-rw-r--r--src/script/lua_api/l_util.cpp24
-rw-r--r--src/script/lua_api/l_util.h3
8 files changed, 171 insertions, 113 deletions
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index 484af2ec3..916983982 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -520,7 +520,7 @@ int ModApiClient::l_get_objects_inside_radius(lua_State *L)
int i = 0;
lua_createtable(L, objs.size(), 0);
for (const auto obj : objs) {
- ClientObjectRef::create(L, obj.obj); // TODO: getObjectRefOrCreate
+ push_objectRef(L, obj.obj->getId());
lua_rawseti(L, -2, ++i);
}
return 1;
diff --git a/src/script/lua_api/l_clientobject.cpp b/src/script/lua_api/l_clientobject.cpp
index 76d0d65ab..c093e754e 100644
--- a/src/script/lua_api/l_clientobject.cpp
+++ b/src/script/lua_api/l_clientobject.cpp
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "lua_api/l_clientobject.h"
#include "l_internal.h"
#include "common/c_converter.h"
+#include "common/c_content.h"
#include "client/client.h"
#include "object_properties.h"
#include "util/pointedthing.h"
@@ -47,6 +48,8 @@ ClientActiveObject *ClientObjectRef::get_cao(ClientObjectRef *ref)
GenericCAO *ClientObjectRef::get_generic_cao(ClientObjectRef *ref, lua_State *L)
{
ClientActiveObject *obj = get_cao(ref);
+ if (!obj)
+ return nullptr;
ClientEnvironment &env = getClient(L)->getEnv();
GenericCAO *gcao = env.getGenericCAO(obj->getId());
return gcao;
@@ -56,6 +59,8 @@ int ClientObjectRef::l_get_pos(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
ClientActiveObject *cao = get_cao(ref);
+ if (!cao)
+ return 0;
push_v3f(L, cao->getPosition() / BS);
return 1;
}
@@ -64,6 +69,8 @@ int ClientObjectRef::l_get_velocity(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
push_v3f(L, gcao->getVelocity() / BS);
return 1;
}
@@ -72,6 +79,8 @@ int ClientObjectRef::l_get_acceleration(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
push_v3f(L, gcao->getAcceleration() / BS);
return 1;
}
@@ -80,6 +89,8 @@ int ClientObjectRef::l_get_rotation(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
push_v3f(L, gcao->getRotation());
return 1;
}
@@ -88,6 +99,8 @@ int ClientObjectRef::l_is_player(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
lua_pushboolean(L, gcao->isPlayer());
return 1;
}
@@ -96,6 +109,8 @@ int ClientObjectRef::l_is_local_player(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
lua_pushboolean(L, gcao->isLocalPlayer());
return 1;
}
@@ -104,6 +119,8 @@ int ClientObjectRef::l_get_name(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
lua_pushstring(L, gcao->getName().c_str());
return 1;
}
@@ -112,14 +129,23 @@ int ClientObjectRef::l_get_attach(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- create(L, gcao->getParent());
+ if (!gcao)
+ return 0;
+ ClientActiveObject *parent = gcao->getParent();
+ if (!parent)
+ return 0;
+ push_objectRef(L, parent->getId());
return 1;
}
int ClientObjectRef::l_get_nametag(lua_State *L)
{
+ log_deprecated(L, "Deprecated call to get_nametag, use get_properties().nametag "
+ "instead");
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
ObjectProperties *props = gcao->getProperties();
lua_pushstring(L, props->nametag.c_str());
return 1;
@@ -127,8 +153,12 @@ int ClientObjectRef::l_get_nametag(lua_State *L)
int ClientObjectRef::l_get_item_textures(lua_State *L)
{
+ log_deprecated(L, "Deprecated call to get_item_textures, use "
+ "get_properties().textures instead");
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
ObjectProperties *props = gcao->getProperties();
lua_newtable(L);
@@ -138,20 +168,49 @@ int ClientObjectRef::l_get_item_textures(lua_State *L)
return 1;
}
-int ClientObjectRef::l_get_hp(lua_State *L)
+int ClientObjectRef::l_get_max_hp(lua_State *L)
{
+ log_deprecated(L, "Deprecated call to get_max_hp, use get_properties().hp_max "
+ "instead");
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- lua_pushnumber(L, gcao->getHp());
+ if (!gcao)
+ return 0;
+ ObjectProperties *props = gcao->getProperties();
+ lua_pushnumber(L, props->hp_max);
return 1;
}
-int ClientObjectRef::l_get_max_hp(lua_State *L)
+int ClientObjectRef::l_get_properties(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- ObjectProperties *props = gcao->getProperties();
- lua_pushnumber(L, props->hp_max);
+ if (!gcao)
+ return 0;
+ ObjectProperties *prop = gcao->getProperties();
+ push_object_properties(L, prop);
+ return 1;
+}
+
+int ClientObjectRef::l_set_properties(lua_State *L)
+{
+ ClientObjectRef *ref = checkobject(L, 1);
+ GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
+ ObjectProperties prop = *gcao->getProperties();
+ read_object_properties(L, 2, nullptr, &prop, getClient(L)->idef());
+ gcao->setProperties(prop);
+ return 1;
+}
+
+int ClientObjectRef::l_get_hp(lua_State *L)
+{
+ ClientObjectRef *ref = checkobject(L, 1);
+ GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
+ lua_pushnumber(L, gcao->getHp());
return 1;
}
@@ -159,6 +218,8 @@ int ClientObjectRef::l_punch(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
PointedThing pointed(gcao->getId(), v3f(0, 0, 0), v3s16(0, 0, 0), 0);
getClient(L)->interact(INTERACT_START_DIGGING, pointed);
return 0;
@@ -168,6 +229,8 @@ int ClientObjectRef::l_rightclick(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
PointedThing pointed(gcao->getId(), v3f(0, 0, 0), v3s16(0, 0, 0), 0);
getClient(L)->interact(INTERACT_PLACE, pointed);
return 0;
@@ -177,23 +240,42 @@ int ClientObjectRef::l_remove(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
ClientActiveObject *cao = get_cao(ref);
+ if (!cao)
+ return 0;
getClient(L)->getEnv().removeActiveObject(cao->getId());
return 0;
}
+int ClientObjectRef::l_set_nametag_images(lua_State *L)
+{
+ ClientObjectRef *ref = checkobject(L, 1);
+ GenericCAO *gcao = get_generic_cao(ref, L);
+ if (!gcao)
+ return 0;
+ gcao->nametag_images.clear();
+ if (lua_istable(L, 2)) {
+ lua_pushnil(L);
+ while (lua_next(L, 2) != 0) {
+ gcao->nametag_images.push_back(lua_tostring(L, -1));
+ lua_pop(L, 1);
+ }
+ }
+ gcao->updateNametag();
+
+ return 0;
+}
+
ClientObjectRef::ClientObjectRef(ClientActiveObject *object) : m_object(object)
{
}
void ClientObjectRef::create(lua_State *L, ClientActiveObject *object)
{
- if (object) {
- ClientObjectRef *o = new ClientObjectRef(object);
- *(void **)(lua_newuserdata(L, sizeof(void *))) = o;
- luaL_getmetatable(L, className);
- lua_setmetatable(L, -2);
- }
+ ClientObjectRef *o = new ClientObjectRef(object);
+ *(void **)(lua_newuserdata(L, sizeof(void *))) = o;
+ luaL_getmetatable(L, className);
+ lua_setmetatable(L, -2);
}
void ClientObjectRef::create(lua_State *L, s16 id)
@@ -201,6 +283,12 @@ void ClientObjectRef::create(lua_State *L, s16 id)
create(L, ((ClientEnvironment *)getEnv(L))->getActiveObject(id));
}
+void ClientObjectRef::set_null(lua_State *L)
+{
+ ClientObjectRef *obj = checkobject(L, -1);
+ obj->m_object = nullptr;
+}
+
int ClientObjectRef::gc_object(lua_State *L)
{
ClientObjectRef *obj = *(ClientObjectRef **)(lua_touserdata(L, 1));
@@ -245,6 +333,9 @@ luaL_Reg ClientObjectRef::methods[] = {luamethod(ClientObjectRef, get_pos),
luamethod(ClientObjectRef, get_attach),
luamethod(ClientObjectRef, get_nametag),
luamethod(ClientObjectRef, get_item_textures),
+ luamethod(ClientObjectRef, get_properties),
+ luamethod(ClientObjectRef, set_properties),
luamethod(ClientObjectRef, get_hp),
luamethod(ClientObjectRef, get_max_hp), luamethod(ClientObjectRef, punch),
- luamethod(ClientObjectRef, rightclick), {0, 0}};
+ luamethod(ClientObjectRef, rightclick),
+ luamethod(ClientObjectRef, set_nametag_images), {0, 0}};
diff --git a/src/script/lua_api/l_clientobject.h b/src/script/lua_api/l_clientobject.h
index ebc0f2a90..c4c95cb41 100644
--- a/src/script/lua_api/l_clientobject.h
+++ b/src/script/lua_api/l_clientobject.h
@@ -35,6 +35,8 @@ public:
static void create(lua_State *L, ClientActiveObject *object);
static void create(lua_State *L, s16 id);
+ static void set_null(lua_State *L);
+
static ClientObjectRef *checkobject(lua_State *L, int narg);
private:
@@ -75,9 +77,15 @@ private:
// get_nametag(self)
static int l_get_nametag(lua_State *L);
- // get_textures(self)
+ // get_item_textures(self)
static int l_get_item_textures(lua_State *L);
+ // get_properties(self)
+ static int l_get_properties(lua_State *L);
+
+ // set_properties(self, properties)
+ static int l_set_properties(lua_State *L);
+
// get_hp(self)
static int l_get_hp(lua_State *L);
@@ -92,4 +100,7 @@ private:
// remove(self)
static int l_remove(lua_State *L);
+
+ // set_nametag_images(self, images)
+ static int l_set_nametag_images(lua_State *L);
};
diff --git a/src/script/lua_api/l_localplayer.cpp b/src/script/lua_api/l_localplayer.cpp
index 747657016..4f57ee00f 100644
--- a/src/script/lua_api/l_localplayer.cpp
+++ b/src/script/lua_api/l_localplayer.cpp
@@ -84,7 +84,7 @@ int LuaLocalPlayer::l_set_yaw(lua_State *L)
LocalPlayer *player = getobject(L, 1);
if (lua_isnumber(L, 2)) {
- int yaw = lua_tonumber(L, 2);
+ double yaw = lua_tonumber(L, 2);
player->setYaw(yaw);
g_game->cam_view.camera_yaw = yaw;
g_game->cam_view_target.camera_yaw = yaw;
@@ -104,7 +104,7 @@ int LuaLocalPlayer::l_set_pitch(lua_State *L)
LocalPlayer *player = getobject(L, 1);
if (lua_isnumber(L, 2)) {
- int pitch = lua_tonumber(L, 2);
+ double pitch = lua_tonumber(L, 2);
player->setPitch(pitch);
g_game->cam_view.camera_pitch = pitch;
g_game->cam_view_target.camera_pitch = pitch;
@@ -483,7 +483,7 @@ int LuaLocalPlayer::l_get_object(lua_State *L)
ClientEnvironment &env = getClient(L)->getEnv();
ClientActiveObject *obj = env.getGenericCAO(player->getCAO()->getId());
- ClientObjectRef::create(L, obj);
+ push_objectRef(L, obj->getId());
return 1;
}
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index 4d437b967..d88bf31c1 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -34,9 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serverlist.h"
#include "mapgen/mapgen.h"
#include "settings.h"
-
-#include <IFileArchive.h>
-#include <IFileSystem.h>
+#include "client/client.h"
#include "client/renderingengine.h"
#include "network/networkprotocol.h"
@@ -399,7 +397,8 @@ int ModApiMainMenu::l_show_keys_menu(lua_State *L)
GUIEngine* engine = getGuiEngine(L);
sanity_check(engine != NULL);
- GUIKeyChangeMenu *kmenu = new GUIKeyChangeMenu(RenderingEngine::get_gui_env(),
+ GUIKeyChangeMenu *kmenu = new GUIKeyChangeMenu(
+ engine->m_rendering_engine->get_gui_env(),
engine->m_parent,
-1,
engine->m_menumanager,
@@ -629,75 +628,9 @@ int ModApiMainMenu::l_extract_zip(lua_State *L)
std::string absolute_destination = fs::RemoveRelativePathComponents(destination);
if (ModApiMainMenu::mayModifyPath(absolute_destination)) {
+ auto rendering_engine = getGuiEngine(L)->m_rendering_engine;
fs::CreateAllDirs(absolute_destination);
-
- io::IFileSystem *fs = RenderingEngine::get_filesystem();
-
- if (!fs->addFileArchive(zipfile, false, false, io::EFAT_ZIP)) {
- lua_pushboolean(L,false);
- return 1;
- }
-
- sanity_check(fs->getFileArchiveCount() > 0);
-
- /**********************************************************************/
- /* WARNING this is not threadsafe!! */
- /**********************************************************************/
- io::IFileArchive* opened_zip =
- fs->getFileArchive(fs->getFileArchiveCount()-1);
-
- const io::IFileList* files_in_zip = opened_zip->getFileList();
-
- unsigned int number_of_files = files_in_zip->getFileCount();
-
- for (unsigned int i=0; i < number_of_files; i++) {
- std::string fullpath = destination;
- fullpath += DIR_DELIM;
- fullpath += files_in_zip->getFullFileName(i).c_str();
- std::string fullpath_dir = fs::RemoveLastPathComponent(fullpath);
-
- if (!files_in_zip->isDirectory(i)) {
- if (!fs::PathExists(fullpath_dir) && !fs::CreateAllDirs(fullpath_dir)) {
- fs->removeFileArchive(fs->getFileArchiveCount()-1);
- lua_pushboolean(L,false);
- return 1;
- }
-
- io::IReadFile* toread = opened_zip->createAndOpenFile(i);
-
- FILE *targetfile = fopen(fullpath.c_str(),"wb");
-
- if (targetfile == NULL) {
- fs->removeFileArchive(fs->getFileArchiveCount()-1);
- lua_pushboolean(L,false);
- return 1;
- }
-
- char read_buffer[1024];
- long total_read = 0;
-
- while (total_read < toread->getSize()) {
-
- unsigned int bytes_read =
- toread->read(read_buffer,sizeof(read_buffer));
- if ((bytes_read == 0 ) ||
- (fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read))
- {
- fclose(targetfile);
- fs->removeFileArchive(fs->getFileArchiveCount()-1);
- lua_pushboolean(L,false);
- return 1;
- }
- total_read += bytes_read;
- }
-
- fclose(targetfile);
- }
-
- }
-
- fs->removeFileArchive(fs->getFileArchiveCount()-1);
- lua_pushboolean(L,true);
+ lua_pushboolean(L, fs::extractZipFile(rendering_engine->get_filesystem(), zipfile, destination));
return 1;
}
@@ -716,24 +649,28 @@ int ModApiMainMenu::l_get_mainmenu_path(lua_State *L)
}
/******************************************************************************/
-bool ModApiMainMenu::mayModifyPath(const std::string &path)
+bool ModApiMainMenu::mayModifyPath(std::string path)
{
+ path = fs::RemoveRelativePathComponents(path);
+
if (fs::PathStartsWith(path, fs::TempPath()))
return true;
- if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "games")))
- return true;
+ std::string path_user = fs::RemoveRelativePathComponents(porting::path_user);
- if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "mods")))
+ if (fs::PathStartsWith(path, path_user + DIR_DELIM "client"))
return true;
-
- if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "clientmods")))
+ if (fs::PathStartsWith(path, path_user + DIR_DELIM "clientmods"))
return true;
-
- if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "textures")))
+ if (fs::PathStartsWith(path, path_user + DIR_DELIM "textures"))
return true;
-
- if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM "worlds")))
+ if (fs::PathStartsWith(path, path_user + DIR_DELIM "games"))
+ return true;
+ if (fs::PathStartsWith(path, path_user + DIR_DELIM "mods"))
+ return true;
+ if (fs::PathStartsWith(path, path_user + DIR_DELIM "textures"))
+ return true;
+ if (fs::PathStartsWith(path, path_user + DIR_DELIM "worlds"))
return true;
if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_cache)))
@@ -763,7 +700,7 @@ int ModApiMainMenu::l_show_path_select_dialog(lua_State *L)
bool is_file_select = readParam<bool>(L, 3);
GUIFileSelectMenu* fileOpenMenu =
- new GUIFileSelectMenu(RenderingEngine::get_gui_env(),
+ new GUIFileSelectMenu(engine->m_rendering_engine->get_gui_env(),
engine->m_parent,
-1,
engine->m_menumanager,
@@ -859,15 +796,7 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
lua_pushnumber(L,RenderingEngine::getDisplayDensity());
lua_settable(L, top);
- lua_pushstring(L,"display_width");
- lua_pushnumber(L,RenderingEngine::getDisplaySize().X);
- lua_settable(L, top);
-
- lua_pushstring(L,"display_height");
- lua_pushnumber(L,RenderingEngine::getDisplaySize().Y);
- lua_settable(L, top);
-
- const v2u32 &window_size = RenderingEngine::get_instance()->getWindowSize();
+ const v2u32 &window_size = RenderingEngine::getWindowSize();
lua_pushstring(L,"window_width");
lua_pushnumber(L, window_size.X);
lua_settable(L, top);
@@ -875,6 +804,10 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
lua_pushstring(L,"window_height");
lua_pushnumber(L, window_size.Y);
lua_settable(L, top);
+
+ lua_pushstring(L, "render_info");
+ lua_pushstring(L, wide_to_utf8(RenderingEngine::get_video_driver()->getName()).c_str());
+ lua_settable(L, top);
return 1;
}
diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h
index 49ce7c251..33ac9e721 100644
--- a/src/script/lua_api/l_mainmenu.h
+++ b/src/script/lua_api/l_mainmenu.h
@@ -58,7 +58,7 @@ private:
* @param path path to check
* @return true if the path may be modified
*/
- static bool mayModifyPath(const std::string &path);
+ static bool mayModifyPath(std::string path);
//api calls
diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp
index 60ae7871c..624828956 100644
--- a/src/script/lua_api/l_util.cpp
+++ b/src/script/lua_api/l_util.cpp
@@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "irrlichttypes_extrabloated.h"
#include "lua_api/l_util.h"
#include "lua_api/l_internal.h"
#include "lua_api/l_settings.h"
@@ -40,7 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/hex.h"
#include "util/sha1.h"
#include <algorithm>
-
+#include <cstdio>
// log([level,] text)
// Writes a line to the logger.
@@ -479,6 +480,23 @@ int ModApiUtil::l_sha1(lua_State *L)
return 1;
}
+// colorspec_to_colorstring(colorspec)
+int ModApiUtil::l_colorspec_to_colorstring(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+
+ video::SColor color(0);
+ if (read_color(L, 1, &color)) {
+ char colorstring[10];
+ snprintf(colorstring, 10, "#%02X%02X%02X%02X",
+ color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
+ lua_pushstring(L, colorstring);
+ return 1;
+ }
+
+ return 0;
+}
+
void ModApiUtil::Initialize(lua_State *L, int top)
{
API_FCT(log);
@@ -513,6 +531,7 @@ void ModApiUtil::Initialize(lua_State *L, int top)
API_FCT(get_version);
API_FCT(sha1);
+ API_FCT(colorspec_to_colorstring);
LuaSettings::create(L, g_settings, g_settings_path);
lua_setfield(L, top, "settings");
@@ -539,6 +558,7 @@ void ModApiUtil::InitializeClient(lua_State *L, int top)
API_FCT(get_version);
API_FCT(sha1);
+ API_FCT(colorspec_to_colorstring);
LuaSettings::create(L, g_settings, g_settings_path);
lua_setfield(L, top, "settings");
@@ -569,8 +589,8 @@ void ModApiUtil::InitializeAsync(lua_State *L, int top)
API_FCT(get_version);
API_FCT(sha1);
+ API_FCT(colorspec_to_colorstring);
LuaSettings::create(L, g_settings, g_settings_path);
lua_setfield(L, top, "settings");
}
-
diff --git a/src/script/lua_api/l_util.h b/src/script/lua_api/l_util.h
index dbdd62b99..6943a6afb 100644
--- a/src/script/lua_api/l_util.h
+++ b/src/script/lua_api/l_util.h
@@ -101,6 +101,9 @@ private:
// sha1(string, raw)
static int l_sha1(lua_State *L);
+ // colorspec_to_colorstring(colorspec)
+ static int l_colorspec_to_colorstring(lua_State *L);
+
public:
static void Initialize(lua_State *L, int top);
static void InitializeAsync(lua_State *L, int top);