Modul:Wechselkurs
| Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | |||
| Modul | Deutsch | English
|
Modul: | Dokumentation | ||
Diese Seite enthält Code in der Programmiersprache Lua. Einbindungszahl Cirrus
Das Modul dient der Umrechnung von Währungen.
Funktionen
CallValue
Gibt den Umrechnungskurs einer Fremdwährung in Euro an
- Parameter:
- 1 : Ein zulässiges Kürzel (s.u.)
- Rückgabe: Zahlenwert
CallQuote
- Parameter:
- 1 : Ein zulässiges Kürzel für die Ausgangswährung (s.u.)
- 2 : Ein zulässiges Kürzel für die Zielwährung (s.u.)
- Rückgabe: Zahlenwert
GetTimestamp
- Parameter: keine
- Rückgabe: Datum der Daten im ISO-Format
GetSource
- Parameter: keine
- Rückgabe: URL der Datenquelle
Aktuell gültige Währungskürzel
| Währung | Kürzel |
|---|---|
| Emirati Dirham | AED |
| Argentine Peso | ARS |
| Australian Dollar | AUD |
| Bahraini Dinar | BHD |
| Bruneian Dollar | BND |
| Brazilian Real | BRL |
| Botswana Pula | BWP |
| Canadian Dollar | CAD |
| Swiss Franc | CHF |
| Chilean Peso | CLP |
| Chinese Yuan Renminbi | CNY |
| Colombian Peso | COP |
| Czech Koruna | CZK |
| Danish Krone | DKK |
| Euro | EUR |
| British Pound | GBP |
| Hong Kong Dollar | HKD |
| Hungarian Forint | HUF |
| Indonesian Rupiah | IDR |
| Israeli Shekel | ILS |
| Indian Rupee | INR |
| Iranian Rial | IRR |
| Icelandic Krona | ISK |
| Japanese Yen | JPY |
| South Korean Won | KRW |
| Kuwaiti Dinar | KWD |
| Kazakhstani Tenge | KZT |
| Sri Lankan Rupee | LKR |
| Libyan Dinar | LYD |
| Mauritian Rupee | MUR |
| Mexican Peso | MXN |
| Malaysian Ringgit | MYR |
| Norwegian Krone | NOK |
| Nepalese Rupee | NPR |
| New Zealand Dollar | NZD |
| Omani Rial | OMR |
| Philippine Peso | PHP |
| Pakistani Rupee | PKR |
| Polish Zloty | PLN |
| Qatari Riyal | QAR |
| Romanian New Leu | RON |
| Russian Ruble | RUB |
| Saudi Arabian Riyal | SAR |
| Swedish Krona | SEK |
| Singapore Dollar | SGD |
| Thai Baht | THB |
| Turkish Lira | TRY |
| Trinidadian Dollar | TTD |
| Taiwan New Dollar | TWD |
| US Dollar | USD |
| South African Rand | ZAR |
function GetTheRate(Currency)
local cur = string.upper(Currency)
local tbl = mw.loadJsonData("Modul:Wechselkurs/Wechselkurs.json")
local value = 0
if type(tbl.data) =="table" then
for t,v in pairs(tbl.data) do
if t == cur then
value = v
end
end
return value
end
end
local p={}
function p.CallValue(frame)
return GetTheRate(frame.args[1])
end
function p.CallQuote(frame)
local von = frame.args[1] or "EUR"
local nach = frame.args[2] or "EUR"
local errtext = "Erlaubt sind nur EUR, AUD, BRL, CAD, CHF, CNY, CZK, DKK, GBP, HKD, HUF, IDR, ILS, INR, ISK, JPY, KRW, MXN, MYR, NOK, NZD, PHP, PLN, RON, SEK, SGD, THB, TRY, USD und ZAR."
local text = ""
local z = GetTheRate(von)
local n = GetTheRate(nach)
if z == 0 then
text = "Unzulässiges Kürzel für die erste Währung: " .. von .. errtext
end
if n == 0 then
text = "Unzulässiges Kürzel für die zweite Währung: " .. nach .. errtext
end
return tostring(z / n)
end
function p.GetTimestamp(frame)
local tbl = mw.loadJsonData("Modul:Wechselkurs/Wechselkurs.json")
local Date = tbl.signature.timestamp or "unknown"
return Date
end
function p.GetSource(frame)
local tbl = mw.loadJsonData("Modul:Wechselkurs/Wechselkurs.json")
local Source = tbl.signature.timestamp or "unknown"
return Source
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.