History

scripting (lua/js): utils.getpid: make wrapper of pid property

We now have at least 3 scripting APIs which are trivial wrappers around properties: mp.get_mouse_pos, utils.getcwd, utils.getpid. After some discussion on IRC it was decided that it's easier for us to maintain them as trivial wrappers than to deprecate them and inflict pain on users and script authors, so currently no plan to deprecate.

Avi Halachmi (:avih) committed 5 years ago

Commit 02fbdf81 parent f3b2ea94 files · +5 −16Browse files

Showing the changes to player/javascript.c (1 of 4 files). Show all

Unified · Split

player/javascript.c+0−8
@@ -40,7 +40,6 @@ · 39 unmodified lines
40#include "misc/bstr.h"40#include "misc/bstr.h"
41#include "osdep/timer.h"41#include "osdep/timer.h"
42#include "osdep/threads.h"42#include "osdep/threads.h"
43#include "osdep/getpid.h"
44#include "stream/stream.h"43#include "stream/stream.h"
45#include "sub/osd.h"44#include "sub/osd.h"
46#include "core.h"45#include "core.h"
@@ -925,12 +924,6 @@ static void script_get_user_path(js_State *J, void *af) · 878 unmodified lines
925 js_pushstring(J, mp_get_user_path(af, jctx(J)->mpctx->global, path));924 js_pushstring(J, mp_get_user_path(af, jctx(J)->mpctx->global, path));
926}925}
927 926
928// args: none
929static void script_getpid(js_State *J)
930{
931 js_pushnumber(J, mp_getpid());
932}
933
934// args: prefixed file name, data (c-str)927// args: prefixed file name, data (c-str)
935static void script_write_file(js_State *J, void *af)928static void script_write_file(js_State *J, void *af)
936{929{
@@ -1183,7 +1176,6 @@ static const struct fn_entry utils_fns[] = { · 246 unmodified lines
1183 FN_ENTRY(split_path, 1),1176 FN_ENTRY(split_path, 1),
1184 AF_ENTRY(join_path, 2),1177 AF_ENTRY(join_path, 2),
1185 AF_ENTRY(get_user_path, 1),1178 AF_ENTRY(get_user_path, 1),
1186 FN_ENTRY(getpid, 0),
1187 FN_ENTRY(get_env_list, 0),1179 FN_ENTRY(get_env_list, 0),
1188 1180
1189 FN_ENTRY(read_file, 2),1181 FN_ENTRY(read_file, 2),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t