open url in default application * Open URL in default application, typically a browser * * @name sys.open_url * @param url [type:string] url to open * @param [attributes] [type:table] table with attributes * * `target` * - [type:string] [icon:html5]: Optional. Specifies the target attribute or the name of the window. The following values are supported:
| 655 | * ``` |
| 656 | */ |
| 657 | static int Sys_OpenURL(lua_State* L) |
| 658 | { |
| 659 | DM_LUA_STACK_CHECK(L, 1) |
| 660 | int top = lua_gettop(L); |
| 661 | const char* url = luaL_checkstring(L, 1); |
| 662 | dmSys::Result result; |
| 663 | if (top > 1) |
| 664 | { |
| 665 | luaL_checktype(L, 2, LUA_TTABLE); |
| 666 | lua_pushvalue(L, 2); |
| 667 | |
| 668 | lua_getfield(L, -1, "target"); |
| 669 | const char* target = lua_isnil(L, -1) ? 0 : luaL_checkstring(L, -1); |
| 670 | lua_pop(L, 1); |
| 671 | |
| 672 | lua_pop(L, 1); |
| 673 | result = dmSys::OpenURL(url, target); |
| 674 | } |
| 675 | else |
| 676 | { |
| 677 | result = dmSys::OpenURL(url, 0); |
| 678 | } |
| 679 | |
| 680 | lua_pushboolean(L, result == dmSys::RESULT_OK); |
| 681 | |
| 682 | return 1; |
| 683 | } |
| 684 | |
| 685 | /*# loads resource from game data |
| 686 | * |
nothing calls this directly
no test coverage detected