| 653 | } |
| 654 | |
| 655 | void Lua::CheckPen(lua_State *L, Screen::Pen *pen, int index, bool allow_nil, bool allow_color) |
| 656 | { |
| 657 | index = lua_absindex(L, index); |
| 658 | |
| 659 | luaL_checkany(L, index); |
| 660 | |
| 661 | if (lua_isnil(L, index)) |
| 662 | { |
| 663 | if (!allow_nil) |
| 664 | luaL_argerror(L, index, "nil pen not allowed"); |
| 665 | |
| 666 | *pen = Pen(0,0,0,-1); |
| 667 | } |
| 668 | else if (lua_isuserdata(L, index)) |
| 669 | { |
| 670 | *pen = *check_pen_native(L, index); |
| 671 | } |
| 672 | else if (allow_color && lua_isnumber(L, index)) |
| 673 | { |
| 674 | *pen = Pen(0, lua_tointeger(L, index)&15, 0); |
| 675 | } |
| 676 | else |
| 677 | { |
| 678 | luaL_checktype(L, index, LUA_TTABLE); |
| 679 | decode_pen(L, *pen, index); |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | static int adjust_pen(lua_State *L, bool no_copy) |
| 684 | { |
nothing calls this directly
no test coverage detected