AR/getAllAccountData: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
==مــثال== | ==مــثال== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function printAllData ( thePlayer ) | function printAllData(thePlayer) | ||
local playerAccount = getPlayerAccount( thePlayer ) -- | local playerAccount = getPlayerAccount(thePlayer) -- الحصول على حسابة | ||
if ( playerAccount ) then -- | if (playerAccount) then -- إذا تم الحصول على حسابة | ||
local data = getAllAccountData( playerAccount ) -- | local data = getAllAccountData(playerAccount) -- الحصول على الداتا ( البيانات ) 0 | ||
count = 0 | count = 0 | ||
for _ in pairs(data) do count = count + 1 end -- get the count | for _ in pairs(data) do count = count + 1 end -- get the count | ||
outputChatBox ( "table holds " .. count .. " entries" ) -- output number of rows | outputChatBox("table holds " .. count .. " entries") -- output number of rows | ||
if ( data ) then | if (data) then | ||
for k,v in pairs ( data ) do | for k,v in pairs(data) do | ||
outputChatBox(k..": "..v) -- print the key and value of each entry of data | outputChatBox(k..": "..v) -- print the key and value of each entry of data | ||
end | end | ||
Line 29: | Line 29: | ||
end | end | ||
end | end | ||
addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall' | addCommandHandler("getall", printAllData) -- add a command handler for command 'getall' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 14:06, 30 August 2012
هذه الوظيفة تقوم بالرد بجدول يحتوي على جميع البيانات التي في الحساب
Syntax
table getAllAccountData ( account theAccount )
العناصر المطلوبة
- theAccount: الحساب الذي تريد استرداد كافة البيانات منه
الرد
.يحتوي على جميع بيانات الحساب. قد يكون الجدول فارغاً table جدول
مــثال
function printAllData(thePlayer) local playerAccount = getPlayerAccount(thePlayer) -- الحصول على حسابة if (playerAccount) then -- إذا تم الحصول على حسابة local data = getAllAccountData(playerAccount) -- الحصول على الداتا ( البيانات ) 0 count = 0 for _ in pairs(data) do count = count + 1 end -- get the count outputChatBox("table holds " .. count .. " entries") -- output number of rows if (data) then for k,v in pairs(data) do outputChatBox(k..": "..v) -- print the key and value of each entry of data end end end end addCommandHandler("getall", printAllData) -- add a command handler for command 'getall'
المتطلبات
Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.3.0-9.03804" />