Lua: input.lcid_to_pcid

This commit is contained in:
Ilari Liusvaara 2012-10-01 23:23:08 +03:00
parent a5dc55e008
commit 5f1e9e243b
3 changed files with 25 additions and 0 deletions

View file

@ -2905,6 +2905,15 @@ Set the the state of specified controller to values specified in specified
table.
\end_layout
\begin_layout Subsubsection
input.lcid_to_pcid(number controller)
\end_layout
\begin_layout Standard
Return the physical index, physical port and controller number in port for
specified (1-based) logical controller.
\end_layout
\begin_layout Subsection
Table subtitle
\end_layout

View file

@ -1453,6 +1453,11 @@ names of fields vary by controller type.
Set the the state of specified controller to values specified in
specified table.
8.4.11 input.lcid_to_pcid(number controller)
Return the physical index, physical port and controller number in
port for specified (1-based) logical controller.
8.5 Table subtitle
Subtitle handling

View file

@ -190,4 +190,15 @@ namespace
}
return 0;
});
function_ptr_luafun ijlcid_to_pcid("input.lcid_to_pcid", [](lua_State* LS, const std::string& fname) -> int {
unsigned lcid = get_numeric_argument<unsigned>(LS, 1, fname.c_str());
int pcid = controls.lcid_to_pcid(lcid - 1);
if(pcid < 0)
return 0;
lua_pushnumber(LS, pcid);
lua_pushnumber(LS, pcid / 4);
lua_pushnumber(LS, pcid % 4);
return 3;
});
}