os.clock()
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

os.clock()

Started by bastya_elvtars, 05 March, 2005, 01:52:26

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bastya_elvtars

if cmd then
			local x=os.clock()
			if parsecmds(user,data,string.lower(cmd),"MAIN") then
				if LagTest==1 then
					[color=#993399]user:SendData(parseenv(user,env,Bot).."Executing this command took "..os.clock() - x.." seconds.")[/color]
				end
				return 1
			else
				user:SendPM(Bot,"It would be so nice to talk to you, but I have many things to do. So either enter a valid command or stop bugging me! ;)")
			end
		end

Any ideas why this gives the following error?

QuoteSyntax O:\ptokax1604\scripts\lawmaker.lua:4262: attempt to concatenate a nil value
Everything could have been anything else and it would have just as much meaning.

Pothead

Which line is 4262 ? :)

bastya_elvtars

QuoteOriginally posted by Pothead
Which line is 4262 ? :)

The one containing concatenation. :D

OK, I made it purle.
Everything could have been anything else and it would have just as much meaning.

Psycho_Chihuahua

probably not what ur lookin for...

current = os.date("%d:%m:%y - %H:%M")
iMin = 1000*60 
tTime = {
	--["timestring"] = "show this string"
	["06:00"] = "Guten Morgen Hub - Ein neuer Tag ist angebrochen!!",
	["09:30"] = "Morgens halb zehn in Deutschland - KNOPPERS Das Fr?hst?ckchen!! Mahlzeit *fg*",
	["12:00"] = "Guten hunger, all denen die nun was essen!!",
	["22:00"] = "Gut nacht, all denen die schon oder gleich ins Bett gehen!"
}
function Main() 
	current = os.date("%d:%m:%y - %H:%M")
	if tTime[current] then
		SendToAll( ("---" ..current .."---"), tTime[current] )
	end
	frmHub:RegBot("---" ..current .."---")
	SetTimer(iMin) 
	StartTimer() 
end 
function OnTimer()
	frmHub:UnregBot("---" ..current .."---")
	current = os.date("%d:%m:%y - %H:%M")
	if tTime[current] then
		SendToAll( ("---" ..current .."---"), tTime[current] )
	end
	frmHub:RegBot("---" ..current .."---")
end
function OnExit()
frmHub:UnregBot("---" ..current .."---")
end

but maybe something inside could help u
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

user:SendData(parseenv(user,env,Bot).."Executing this command took "..os.clock() - x.." seconds.")
Make sure that parseenv(user,env,Bot) is actually returning smth with the parameters ... and also it'll be poss cleaner to parenthesize (os.clock()-x) while concating it ...
Hope its solved by the time you r reading this .. ;)

NightLitch

when handling 2 values inside a string do it like this:

user:SendData(parseenv(user,env,Bot).."Executing this command took "..(os.clock() - x).." seconds.")

My coin to this... cheers
//NL

bastya_elvtars

#6
The fun is that it works here:

function Main()
	local x=os.clock()
	if not string.find(frmHub:GetHubDescr(), "LawMaker") then
		local tempdescstore = frmHub:GetHubDescr()
		local NewDescription = tempdescstore.." - powered by "..botver
		frmHub:SetHubDescr(NewDescription)
	end
	ipranges=loadipranges()
	local f=io.open("lawmaker/getlogs.bat","w+")
		f:write("dir \""..ptokaxpath.."/scripts/lawmaker/logs\" %1 /-p /o:gn > \""..ptokaxpath.."/scripts/lawmaker/lists/logs.lst\"")
	f:close()
--	Cleaning()
	loadwatchkicks()
	immunelist=maketable("lawmaker/lists/immune.lst")
	bannedranges=maketable("lawmaker/lists/banned_ranges.lst")
	CleanDay = os.date("%Y. %m. %d.")
	if loadfile("lawmaker/inifiles/offline.ini") then 
		require("lawmaker/inifiles/offline.ini")
	end
	if 	loadfile("lawmaker/inifiles/announce.ini") then
		require("lawmaker/inifiles/announce.ini")
	end
	if loadfile("lawmaker/inifiles/leave.ini") then
		require("lawmaker/inifiles/leave.ini")
	end
	GetOpVipChat()
	LoadFile(opchat,"lawmaker/inifiles/opchat.ini")
	LoadFile(vipchat,"lawmaker/inifiles/vipchat.ini")
--	botversion(nil,"MAIN",nil)
--	frmHub:EnableFullData(1)
	frmHub:RegBot(Bot)
	frmHub:RegBot(opchatbot)
	--frmHub:UnRegBot(vipchatbot)
	if enablevipchat==1 then frmHub:RegBot(vipchatbot) end
	fakeshares=maketable("lawmaker/inifiles/fakesharesize.ini")
	NoClean=maketable("lawmaker/lists/noclean.lst")
	NoMotd=maketable("lawmaker/lists/nomotd.lst")
	LoadWarn()
	SetTimer(1000)
	StartTimer()
	ReloadRel()
	loadaway()
	kicks=loadkicks()
	NoMotd=maketable("lawmaker/lists/nomotd.lst")
	userinfo=nil
	Clear()
	userinfo={}
	LoadUserInfo()
	SaveUserinfo()
	SendToOps(Bot,"Booting... done in "..os.clock()-x.." seconds.")
end

@Herodes: parseenv is about 100 times called in my script. IMHO it's the command parsing that flushes it. Gonna try with GLOBAL variable. :S
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

Gonna try with GLOBAL variable.

Does not work either. Need workaround,
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

*was an idiot*

Thx to RabidWombat for directing my attention to parseenv, that was erroneous - altho I still do not 100% understand why.
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk