PtokaX forum

Development Section => Lua tools => Topic started by: Thor on 20 September, 2007, 19:05:44

Title: PtokaX LUA API converter
Post by: Thor on 20 September, 2007, 19:05:44
Since PtokaX has new API in the 0.3.6.0d version, old scripts won't work on it (you get error messages like attempt to index global 'frmHub' (a nil value) and so on...) I made a little program, with which you can easily convert the old open source scripts (so don't try to convert RoboCop :P) to the new API. This program is far from perfect, but the smaller scripts will surely works (I've tried some bigger scripts like forbidden, trivia, badfilesearch and chatrooms, all worked, but no warranty if all will work). You can download it from :LINK REMOVED BY PPK: If you find a bug, or you find a script which won't be perfectly converted, send the script to my e-mail address (you can find it on the about page of the program).
Good luck ;D
Title: Re: PtokaX LUA API converter
Post by: blastbeat on 20 September, 2007, 21:12:42
very nice, thank you!
Title: Re: PtokaX LUA API converter
Post by: Thor on 21 September, 2007, 19:43:07
The file has been updated, some bug has been fixed, if you want to use, please re-download.
Some part of the code can't be converted as I saw like ProfMan.GetProfiles() part, there the code needs manually correction for perfect work.
Title: Re: PtokaX LUA API converter
Post by: Josecar on 04 October, 2007, 02:24:41
Thank you very much for share this.

For me, a lot of work saved.



Title: Re: PtokaX LUA API converter
Post by: 7P-Darkman on 10 October, 2007, 00:56:38

Dear Hungarista,

The link for donwload of the tool is not work to me. It is some blockade for IP addresses of Brazil? It could see this for we, please?

Anticipatedly I am thankful...

Respectfully,

7P-Darkman
Title: Re: PtokaX LUA API converter
Post by: 7P-Darkman on 10 October, 2007, 01:16:05
Sorry friends...

I make download of the tool, but only using the browser Mozila Firefox, and not it using Internet Explorer. Well, now I will go to test in scripts of my HUB!

Respectfully,

7P-Darkman
Title: Re: PtokaX LUA API converter
Post by: Yahoo on 05 January, 2008, 10:07:51
Thanks Hungarista
Convertor works with most of the script cool
Title: Re: PtokaX LUA API converter
Post by: Thor on 05 January, 2008, 13:05:36
Well, maybe you've right, but PPK has 'bigger' right :) He made the new API to reduce the memory- and CPU usage. But this converter use the Core.GetUserAllData() call, which makes the new script equal with the previous PtokaX versions. That's the main reason, why I don't fix it's bugs. Yes, it's good if you are impatient, and you've no time to wait for all scripts. Also good for educational purpose, to learn, what became to what. But to use the scripts converted by this application is not a good idea, and many time can occur run-time errors. But if it's works well to you, then OK. ;)
Title: Re: PtokaX LUA API converter
Post by: ZadOff on 04 March, 2008, 08:22:44
Dear Hungarista,

I send on your mail my not working scripts after convertion - please help...
Thanks!

Respectfully,

ZadOff
Title: Re: PtokaX LUA API converter
Post by: Gnuff? on 04 March, 2008, 15:59:23
Quote from: ZadOff on 04 March, 2008, 08:22:44
Dear Hungarista,

I send on your mail my not working scripts after convertion - please help...
Thanks!

Respectfully,

ZadOff

If you try read Hungarista?s last posts, you know why they might not work.

Try search for your scripts in the finished script section, or post them in the request section.

A lot of scripts are converted in finished section, and some new, you might find what you need there
Title: Re: PtokaX LUA API converter
Post by: ZadOff on 05 March, 2008, 06:29:00
Sorry but I can't find my scripts there... And I don't know what to do(((
Title: Re: PtokaX LUA API converter
Post by: Gnuff? on 05 March, 2008, 14:30:30
Quote from: ZadOff on 05 March, 2008, 06:29:00
Sorry but I can't find my scripts there... And I don't know what to do(((

Well, if your scripts cant be found in finished scripts, i suggest you post them in the Conversion Requests section
Title: Re: PtokaX LUA API converter
Post by: ZadOff on 06 March, 2008, 06:13:46
Has already placed, but no one can help me(((
Title: Re: PtokaX LUA API converter
Post by: Gnuff? on 06 March, 2008, 13:34:34
Maybe it?s because your scripts are in russian or whatever language that is, not many can read that.
But as i see it, PxCommands by Mutor should cover most of your needs and some other, and all that in just one script

Userinfo http://board.ptokax.ath.cx/index.php?topic=7647.0 (http://board.ptokax.ath.cx/index.php?topic=7647.0)
Title: Re: PtokaX LUA API converter
Post by: ZadOff on 07 March, 2008, 08:06:26
Sorry but it not works - same error in my scripts
Title: Re: PtokaX LUA API converter
Post by: ATAG on 12 November, 2008, 15:39:03
Quote-- * Some fix by ATAG @ 12/11/08
-- * CORE: Removed Core.GetAllUserData() from functions
-- *      Core.SendToNick changed to Core.SendToUser
-- *      Core.SendPmToNick changed to Core.SendPmToUser   
-- *      fixed "Core.Ban" like bugs

:ATTACHMENT REMOVED BY PPK:
Title: Re: PtokaX LUA API converter
Post by: kalle370 on 26 November, 2008, 15:55:29
--[[

Birthday Man v.4.07 - LUA 5.0/5.1 by jiten (7/24/2006)
?????????????????????????????????????????????????????
Based on: BirthdayMan v 3.5 by Herodes and mods by C??o?y??

CHANGELOG:
??????????
Rewritten: Whole code;

Changed: Command structure to tables (Function, Permissions, RightClick and Description);
Changed: B-Day table structure to Julian values;
Removed: File content that was sent on B-Day;
Removed: Allowed Age;
Removed: Topic updater (maybe in the future);
Changed: Whole B-Day counting system to os.*;
Changed: Commands returned according to input (Main or PM);
Changed: Many other mods that can't recall at the moment (4/12/2006);
Added: addbirthday command - requested by TT (4/13/2006);
Fixed: Zodiac Sign Dates - thanks to Walazo;
Changed: Error message on empty !bornon result - thanks to Walazo;
Changed: !birthdays' content structure to fix bad tabbing;
Changed: Settings.iVer;
Added: string.lower checks - thanks to Walazo (4/14/2006)
Fixed: !bornon Year function - thanks to Walazo
Added: sNick to keep original nick - requested by TT (4/15/2006);
Changed: *t to !*t;
Fixed: Birthday is at midnight - reported by TT (6/25/2006)
Added: Send Text File content - requested by TT (7/6/2006)
Added: Hub Topic updater - requested by UwV (7/11/2006)
Added: Celebrity's feature - requested by UwV (7/15/2006)
Fixed: BDayCheck function - reported by TT (7/16/2006)
Fixed: Added correct tabbing for messy !birthdays - reported by [NL]_Yvisaur and UwV;
Changed: !birthdays is sorted from Jan to Dez - requested by UwV;
Added: Details and 'All' field to !bornon command - requested by UwV;
Added: Common fields to !celeb command - requested by UwV (7/24/2006)

]]--

-- Edit at will
Settings = {
-- Bot's Name
sBot = frmHub:GetHubBotName(),
-- Script version
iVer = "4.07",
-- Register in userlist
bReg = true,

-- Send File Content (true = on, false = off)
bSendText = true,
-- Birthday Text File
fText = "cake.txt",

-- Update hub topic (true = on, false = off)
bUpdateTopic = true,
-- Use Celebrity's command (true = on, false = off)
bCelebrity = true,

-- Minimum allowed year
iMin = 1900,
-- Time to check for B-Dayers (in hours)
iTime = 12,
-- B-Day Man DB
fBirth = "tBirthday.tbl",
-- Celebrity's DB
fCelebrity = "tCelebrity.tbl"
}

tBirthday = {}

Main = function()
if loadfile(Settings.fBirth) then dofile(Settings.fBirth) end
-- garbagecollect method (Based on Mutor's)
gc = nil; if _VERSION == "Lua 5.1" then gc = "collect" end
if (Settings.sBot ~= frmHub:GetHubBotName()) or Settings.bReg then frmHub:RegBot(Settings.sBot) end
SetTimer(Settings.iTime*60*60*1000); StartTimer()
end

OnTimer = function()
-- Check B-Days
tFunctions.BDayCheck("OnTimer")
-- Collect garbage
collectgarbage(gc); io.flush()
end

NewUserConnected = function(user)
if user.bUserCommand then
for i, v in pairs(tCommands) do
if v.tLevels[user.iProfile] then
local sRC = string.gsub(v.tRC, "{}", i)
user:SendData("$UserCommand 1 3 - FunStuff -\\- Other -\\- BirthDay -\\"..sRC.."|")
end
end
end
-- Check B-Days on connect
tFunctions.BDayCheck("OnConnect", user)
end

OpConnected = NewUserConnected

ChatArrival = function(user, data)
local _,_, to = string.find(data, "^$To:%s(%S+)%s+From:")
local _,_, cmd = string.find(data, "%b<>%s+[%!%+](%S+).*|$")
if cmd then
if tCommands[string.lower(cmd)] then
cmd = string.lower(cmd)
if to == Settings.sBot then user.SendMessage = user.SendPM else user.SendMessage = user.SendPM end
if tCommands[cmd].tLevels[user.iProfile] then
return tCommands[cmd].tFunc(user, data), 1
else
return user:SendMessage(Settings.sBot, "*** Error: You are not allowed to use this command!"), 1
end
end
end
end

ToArrival = ChatArrival

tCommands = {
mybirthday = {
tFunc = function(user, data)
if tBirthday[string.lower(user.sName)] then
local sDate = tFunctions.JulianToDate(tBirthday[string.lower(user.sName)])
user:SendMessage(Settings.sBot, "*** Error: I already have your Birthday on "..sDate..
"! If it wasn't correctly set, ask Operators for help!")
else
local _,_, args = string.find(data, "^%b<>%s+%S+%s+(.*)|$")
if args then
local _,_, d, m, y = string.find(args, "^(%d%d)\/(%d%d)\/(%d%d%d%d)$")
if d and m and y then
tFunctions.AddBirth(user, user.sName, args, d, m, y)
else
user:SendMessage(Settings.sBot, "*** Error: Birthday syntax must be - dd/mm/yyyy")
end
else
user:SendMessage(Settings.sBot, "*** Syntax Error: Type !mybirthday dd/mm/yyyy")
end
end
end,
tLevels = {
[-1] = 1, [0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1,
},
sDesc = "\tAdds your B-Day",
tRC = "Add your B-Day$<%[mynick]> !{} %[line:dd/mm/yyyy]"
},
addbirthday = {
tFunc = function(user, data)
local _,_, args = string.find(data, "^%b<>%s+%S+%s+(.*)|$")
if args then
local _,_, nick,d,m,y = string.find(args, "^(%S+)%s+(%d%d)\/(%d%d)\/(%d%d%d%d)$")
if d and m and y and nick then
if tBirthday[string.lower(nick)] then
local sDate = tFunctions.JulianToDate(tBirthday[string.lower(nick)])
user:SendMessage(Settings.sBot, "*** Error: I already have "..nick.."'s Birthday on "..sDate..
"! If it wasn't correctly set, ask Operators for help!")
else
tFunctions.AddBirth(user, nick, args, d, m, y)
end
else
user:SendMessage(Settings.sBot, "*** Error: Birthday syntax must be: <nick> dd/mm/yyyy")
end
else
user:SendMessage(Settings.sBot, "*** Syntax Error: Type !addbirthday <nick> dd/mm/yyyy")
end
end,
tLevels = {
[0] = 1, [4] = 1, [5] = 1,
},
sDesc = "\tAdds another user's B-Day",
tRC = "Add another user's B-Day$<%[mynick]> !{} %[line:Nick] %[line:dd/mm/yyyy]"
},
delbirthday = {
tFunc = function(user, data)
local _,_, nick = string.find(data, "^%b<>%s+%S+%s+(%S+).*|$")
if nick then
if tBirthday[string.lower(nick)] then
tBirthday[string.lower(nick)] = nil; tFunctions.SaveToFile(Settings.fBirth, tBirthday, "tBirthday")
user:SendMessage(Settings.sBot, "*** Success: "..nick.."'s Birthday was successfully deleted from the DB!")
else
user:SendMessage(Settings.sBot, "*** Error: "..nick.."'s Birthday hasn't been added to the DB yet; or there's a Syntax Error: Type !delbirthday <nick>")
end
else
user:SendMessage(Settings.sBot, "*** Syntax Error: Type !delbirthday <nick>")
end
end,
tLevels = {
[0] = 1, [5] = 1,
},
sDesc = "\tDelete a specific B-Day",
tRC = "Delete user's B-Day$<%[mynick]> !{} %[line:Nick]"
},
birthdays = {
tFunc = function(user)
if next(tBirthday) then
local sMsg, n, tSort = "\r\n\t"..string.rep("=", 105).."\r\n\tNr.\tStatus:\t\tZodiac Sign:\tWeekday:"..
"\tBirthdate:\t\t\tName:\r\n\t"..string.rep("-", 210).."\r\n", 0, {}
for i, v in pairs(tBirthday) do
table.insert(tSort, { sNick = v.sNick, iJulian = v.iJulian, iAdjust = v.iAdjust } )
end
table.sort(tSort, function(a, b) return (os.date("%m%d", a.iJulian) < os.date("%m%d", b.iJulian)) end)
for i, v in ipairs(tSort) do
local sStatus, sTab = "*Offline*", "\t"
n = n + 1; if GetItemByName(v.sNick) then sStatus= "*Online*" end;
local sDate, sWDay, sZodiac = tFunctions.JulianToDate(v)
if string.len(sZodiac) <= 9 then sTab = "\t\t" end
sMsg = sMsg.."\t"..n..".\t"..sStatus.."\t\t"..sZodiac..sTab..sWDay.."\t\t"..sDate..
"\t\t"..v.sNick.."\r\n"
end
user:SendMessage(Settings.sBot, sMsg)
else
user:SendMessage(Settings.sBot, "*** Error: There are no saved Birthdays!")
end
end,
tLevels = {
[-1] = 1, [0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1,
},
sDesc = "\t\tShows all Birthdays",
tRC = "Show all B-Days$<%[mynick]> !{}"
},
myage = {
tFunc = function(user)
if tBirthday[string.lower(user.sName)] then
user:SendMessage(Settings.sBot, "*** You're "..tFunctions.JulianToTime(user).." old according to the Hub's clock!")
else
user:SendMessage(Settings.sBot, "*** Error: Please add your Birthday before using this command. Type !"..
"bhelp for more details!")
end
end,
tLevels = {
[-1] = 1, [0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1,
},
sDesc = "\t\tDisplays your exact age",
tRC = "Show your age$<%[mynick]> !{}"
},
bhelp = {
tFunc = function(user)
local sMsg = "\r\n\t\t"..string.rep("-", 190).."\r\n"..string.rep("\t", 5).."BirthdayMan v."..
Settings.iVer.." by jiten; based on: Herodes'\t\t\t\r\n\t\t"..string.rep("-", 190).."\r\n\t\tAvailable Commands:".."\r\n\r\n"
for i, v in pairs(tCommands) do
if v.tLevels[user.iProfile] then
sMsg = sMsg.."\t\t!"..i.."\t\t"..v.sDesc.."\r\n"
end
end
user:SendMessage(Settings.sBot, sMsg.."\t\t"..string.rep("-", 190));
end,
tLevels = {
[-1] = 1, [0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1,
},
sDesc = "\t\tDisplays this help message",
tRC = "Show command list$<%[mynick]> !{}"
},
bornon = {
tFunc = function(user)
tFunctions.Common(user, tBirthday, "Users")
end,
tLevels = {
[-1] = 1, [0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1,
},
sDesc = "\t\tShows users with whom you share your Birthday",
tRC = "Show list of users you share dates$<%[mynick]> !{}"
},
celeb = {
tFunc = function(user)
if Settings.bCelebrity then
if loadfile(Settings.fCelebrity) then dofile(Settings.fCelebrity) end
tFunctions.Common(user, tCelebrity, "Celebrities")
else
user:SendMessage(Settings.sBot, "*** Error: Celebrity's command is disabled!")
end
end,
tLevels = {
[-1] = 1, [0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1,
},
sDesc = "\t\tShows a list of celebrities that share your birthday",
tRC = "Shows celebrities that share your birthday$<%[mynick]> !{}"
}
}

tFunctions = {}
tFunctions.AddBirth = function(user, nick, args, d, m, y)
if tonumber(y) > Settings.iMin then
local tmp
if tonumber(y) < 1970 then tmp = 1970 - y; y = 1970 else tmp = 0 end
local tTable = { day = tonumber(d), month = tonumber(m), year = tonumber(y), hour = 0, min = 0, sec = 0 }
tBirthday[string.lower(nick)] = { sNick = nick, iJulian = os.time(tTable), iAdjust = tmp }
tFunctions.SaveToFile(Settings.fBirth, tBirthday, "tBirthday")
local sDate, sWDay, sZodiac = tFunctions.JulianToDate(tBirthday[string.lower(nick)])
user:SendMessage(Settings.sBot, "*** "..nick.."'s Birthday is on "..sDate.."! I didn't "..
"know "..nick.." was a "..tFunctions.Zodiac(tBirthday[string.lower(nick)].iJulian).."!")
user:SendMessage(Settings.sBot, "*** New Birthday added by "..user.sName.." on: "..sDate);
else
user:SendMessage(Settings.sBot, "*** Error: The miminum allowed year is "..Settings.iMin.."!")
end
end

tFunctions.Common = function(user, tTempTable, sType)
if tBirthday[string.lower(user.sName)] then
local sMsg, tSame, tUser = "", {}, tBirthday[string.lower(user.sName)]
local tTable = {
["%m"] = { sDesc = "Month" }, ["%d"] = { sDesc = "Day" },
["%y"] = { sDesc = "Year", bExtend = true }, ["%d%m%y"] = { sDesc = "All", bAll = true },
}
for i, v in pairs(tTempTable) do
if i ~= string.lower(user.sName) then
for a, b in pairs(tTable) do
local T, L = os.date("!*t", v.iJulian), os.date("!*t", tUser.iJulian)
local tFunction = function()
if tSame[b.sDesc] then tSame[b.sDesc] = tSame[b.sDesc].."; "..v.sNick else tSame[b.sDesc] = v.sNick end
end
if b.bExtend then
if T.year - v.iAdjust == L.year - tUser.iAdjust then tFunction() end
else
if b.bAll then
if (T.year - v.iAdjust == L.year - tUser.iAdjust) and (os.date("%d%m", v.iJulian) == os.date("%d%m", tUser.iJulian)) then
tFunction()
end
else
if os.date(a, v.iJulian) == os.date(a, tUser.iJulian) then tFunction() end
end
end
end
end
end
for i, v in pairs(tSame) do sMsg = sMsg.."\t"..i.."\t"..v.."\r\n" end;
if sMsg ~= "" then
user:SendMessage(Settings.sBot, "\r\n\t"..string.rep("=", 105)..
"\r\n\t\t\t\t\t"..sType.." born in the same \"Field\" as yours [ "..
tFunctions.JulianToDate(tBirthday[string.lower(user.sName)])..
" ] :\r\n\tField:".."\tNick:\r\n\t"..string.rep("-", 210).."\r\n"..sMsg)
else
user:SendMessage(Settings.sBot, "*** Error: There are no common Birthday fields!")
end
else
user:SendMessage(Settings.sBot, "*** Error: Please add your Birthday before using this command. Type !"..
"bhelp for more details!")
end
end

tFunctions.BDayCheck = function(Mode, nick)
local sTopic = nil
-- Check B-Days
for i, v in pairs(tBirthday) do
if os.date("%m%d", v.iJulian) == (os.date("%m%d")) then
if sTopic then sTopic = sTopic.."; "..v.sNick else sTopic = v.sNick end
if sTopic and tFunctions[Mode] then tFunctions[Mode](nick, i, v, sTopic) end
end
end
end

tFunctions.OnConnect = function(user, i, v)
if i ~= string.lower(user.sName) then
local T = os.date("!*t", os.difftime(os.time(os.date("!*t")), os.time(os.date("!*t", v.iJulian))))
user:SendPM(Settings.sBot, "\r\n\r\n*** It's "..v.sNick.."'s Birthday today! :D He/She is turning "..
(T.year-1970+v.iAdjust).." today! Give a wish :)\r\n\r\n")
else
user:SendPM(Settings.sBot, "\r\n\r\n**** Hey, I know! You have your Birthday TODAY! Happiest of Birthdays!\r\n\r\n")
SendToAll(Settings.sBot, "\r\n\r\n*** Guys!!! "..user.sName.." is here! What do we say? :) \r\n***HAPPY BIRTHDAY TODAY "..user.sName.."!!!\r\n\r\n")
end
end

tFunctions.OnTimer = function(user, i, v, sTopic)
if GetItemByName(i) then
-- Send File Content
if Settings.bSendText then
local sMsg = ""
local f = io.open(Settings.fText)
if f then sMsg = f:read("*all"); f:close() end
SendToAll(Settings.sBot, "\r\n\r\n"..sMsg)
end
-- Send Message
local user = GetItemByName(i)
local T = os.date("!*t", os.difftime(os.time(os.date("!*t")), os.time(os.date("!*t", v.iJulian))))
local iAge = (T.year - 1970 + v.iAdjust)
local tSurprise = {
user.sName.." is gonna have a PAAARTY today! He/She is turning "..
iAge.."! Happy Birthday!!!",
"All of you: Spam "..user.sName.." with Birthday messages ;) ... turning "..
iAge.." today!!!",
"Who's turning "..iAge.." today? :D The day AND the night belongs to "..
user.sName.."!",
"Happy Birthday to you, Happy Birthday dear "..user.sName..
", we all wish you that "..iAge.." will be better than your "..
(iAge-1).."! :)",
"I think Mr "..user.sName.." has his/her birthday today. He/She should be "..
"turning "..iAge.." today ;D",
"A "..tFunctions.Zodiac(v.iJulian).." is turning "..iAge
.." today! It's "..user.sName.."'s birthday!!!"
}
SendToAll(Settings.sBot, tSurprise[math.random(1, table.getn(tSurprise))])
end
-- Update Topic
if Settings.bUpdateTopic then
local _,_, sHubTopic = string.find((frmHub:GetHubTopic() or ""), "(.-)%s-%sToday's.*")
frmHub:SetHubTopic((sHubTopic or "").."Today's birthday(s): "..sTopic)
end
end

tFunctions.JulianToDate = function(v)
local iYear = (os.date("%Y", v.iJulian) - v.iAdjust)
local sDate = os.date("%b %d, "..iYear, v.iJulian)
local sWDay, sZodiac = os.date("%a", v.iJulian), tFunctions.Zodiac(v.iJulian)
return sDate, sWDay, sZodiac
end

tFunctions.Zodiac = function(iJulian)
local tZodiac = {
[01] = { 20, "Capricorn", "Aquarius" }, [02] = { 19, "Aquarius", "Pisces" },
[03] = { 21, "Pisces",  "Aries" }, [04] = { 20, "Aries", "Taurus" },
[05] = { 21, "Taurus", "Gemini" }, [06] = { 21, "Gemini", "Cancer" },
[07] = { 23, "Cancer", "Leo" }, [08] = { 23, "Leo", "Virgo" },
[09] = { 23, "Virgo", "Libra" }, [10] = { 23, "Libra", "Scorpio" },
[11] = { 22, "Scorpio", "Sagittarius" }, [12] = { 22, "Sagittarius", "Capricorn"},
}
local tTmp = tonumber(os.date("%m", iJulian))
if tZodiac[tTmp][1] > tonumber(os.date("%d", iJulian)) then return tZodiac[tTmp][2] else  return tZodiac[tTmp][3] end
end

tFunctions.JulianToTime = function(user)
local iDiff = os.difftime(os.time(os.date("!*t")), os.time(os.date("!*t", tBirthday[string.lower(user.sName)].iJulian)))
if iDiff > 0 then
local T = os.date("!*t", iDiff)
return string.format("%i year(s), %i month(s) and %i day(s)", (T.year-1970+tBirthday[string.lower(user.sName)].iAdjust), (T.month-1), (T.day-1), T.hour, T.min, T.sec)
end
end

tFunctions.Serialize = function(tTable, sTableName, hFile, sTab)
sTab = sTab or "";
hFile:write(sTab..sTableName.." = {\n");
for key, value in pairs(tTable) do
if (type(value) ~= "function") then
local sKey = (type(key) == "string") and string.format("[%q]", key) or string.format("[%d]", key);
if(type(value) == "table") then
tFunctions.Serialize(value, sKey, hFile, sTab.."\t");
else
local sValue = (type(value) == "string") and string.format("%q", value) or tostring(value);
hFile:write(sTab.."\t"..sKey.." = "..sValue);
end
hFile:write(",\n");
end
end
hFile:write(sTab.."}");
end

tFunctions.SaveToFile = function(file, table, tablename)
local hFile = io.open(file, "w+") tFunctions.Serialize(table, tablename, hFile); hFile:close()
end


have try to convert taht but the commands not work :(
Title: Re: PtokaX LUA API converter
Post by: ATAG on 27 November, 2008, 03:17:12
It will newer working on new api with a simple conversion.
QuoteCHANGELOG:
   ??????????
   Rewritten: Whole code;
we must do it again :D
Title: Re: PtokaX LUA API converter
Post by: kalle370 on 27 November, 2008, 10:35:46
ok :(

what shall i so do ??
Title: Re: PtokaX LUA API converter
Post by: ATAG on 29 November, 2008, 10:06:23
Quote from: kalle370 on 27 November, 2008, 10:35:46
ok :(

what shall i so do ??
Check this one (http://forum.ptokax.org/index.php?topic=8154.0) :)
Title: Re: PtokaX LUA API converter
Post by: kalle370 on 29 November, 2008, 23:45:24
thanks friend ;)
Title: Re: PtokaX LUA API converter
Post by: ruler on 30 November, 2008, 23:08:06
nice little converter, worked a charm on my old fun script :) thanks m8
Title: Re: PtokaX LUA API converter
Post by: 11hh on 24 January, 2009, 00:47:40
chance may have got deleted in this manner again up I laid it
(http://forum.ptokax.org/Themes/dilbermc/images/warnwarn.gif) Don't re-upload files remove on purpose
Title: Re: PtokaX LUA API converter
Post by: CrazyGuy on 24 January, 2009, 00:58:23
Due to problems caused by the LUA API Converter, we've decided to remove all links pointing to this tool.
Unless a new, fully functioning version is released, this topic will remain locked.

For those that have the tool, we'd like you to stop (ab)using it. Those that uploaded it on a different forum are requested to forward this information.
No support whatsoever will be given for problems caused by scripts converted with this tool.
Do not ask, requests will be removed.
Title: Re: PtokaX LUA API converter
Post by: Thor on 26 January, 2009, 17:35:07
New one is also avaible, changes are in the changelog.txt.
Download (http://dcpp.hu/converter.zip)
NOTIFY for dumb users:
1; This application can make your life easier, but won't solve every problem. As the licence says: "This program is distributed in the hope that it will be useful"
2; This application can convert old API to new API, but can't convert oldest API to newest one. If you see DataArrival in your script, forget this application.
3; Even you remove the code that the application writes into the first line, it doesn't mean you made it. (It's not because I like write into scripts and see it's converted with my app. It's because the converter will look for it.)
Title: Re: PtokaX LUA API converter
Post by: nEgativE on 22 March, 2015, 17:58:46
Hi there, any link available for this tool, or a way to convert scripts from old api ? thx.
Title: Re: PtokaX LUA API converter
Post by: the-master on 23 March, 2015, 16:55:43
No, Do it yourself or search for newer scripts on this forum