Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: code/parse/lua.cpp
- ===================================================================
- --- code/parse/lua.cpp (revision 11247)
- +++ code/parse/lua.cpp (working copy)
- @@ -11619,6 +11619,39 @@
- return ADE_RETURN_NIL;
- }
- +ADE_FUNC(getButtonControl, l_Control_Info, "number, string", "Reads the defined button control from lua button control data; if number is -1 it tries to use the string", "boolean", "Whether or not the given control is pressed.")
- +{
- + int index;
- + char *buf = NULL;
- + int a, b;
- +
- + if(!ade_get_args(L, "i|s", &index, &buf))
- + return ADE_RETURN_NIL;
- +
- + if(index != -1) {
- + // Process the number
- + if (index > (4 * 32))
- + return ADE_RETURN_NIL;
- +
- + a = index / 32;
- + b = index % 32;
- + } else if (buf != NULL) {
- + int i;
- + for(i=0; i<num_plr_commands; i++) {
- + if(!(strcmp(buf, plr_commands[i].name))) {
- + a = plr_commands[i].var;
- + b = plr_commands[i].def % 32;
- + break;
- + }
- + }
- + if (i == num_plr_commands) {
- + return ADE_RETURN_NIL;
- + }
- + }
- +
- + return ade_set_args(L, "b", Player->lua_bi.status[a] & (1<<b));
- +}
- +
- ADE_FUNC(getButtonControlName, l_Control_Info, "number", "Gives the name of the command corresponding with the given number", "string", "Name of the command")
- {
- int index;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement