This your ConsoleTest.love modified.
Summary of change:
- Show/hide console are totally manage outside of Console.lua (press F1 to toggle)
- You can register command that will be use in console.
- One of them are named "lua". It evaluate/execute the rest of the line as lua code (like previous default behavior)
- I have replace the Console:printv by the BlackNecro' s one with some personnal change (to show exactly the type of key/value)
- Some other things that I forgot.
Have fun!
A console thing
Re: A console thing
- Attachments
-
- consoletest_bytst.love
- Modified version of Original zeedy's ConsoleTest.love
- (31.68 KiB) Downloaded 228 times
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
- counterfactual_jones
- Prole
- Posts: 24
- Joined: Mon Feb 09, 2009 10:14 am
Re: A console thing
I'm getting lots of "bad argument #1 to pairs" when I use printv. You should detect such conditions yourself and give a slightly less jarring error message than the Love error message. Like:TsT wrote:This your ConsoleTest.love modified.
Code: Select all
function Console:printv(inTable,scope)
++ if type(inTable) != "table" then self:print("I am error!"); return end
scope = scope or 0
local spacer = string.rep(" ",scope*3) or ""
for var, value in pairs(inTable) do
if type(value) == "table" then
self:print(spacer..tostring(var).." = ".. tostring(value))
self:printv(value, scope + 1)
else
local printvar = type(var) == "string" and '"'..tostring(var)..'"' or tostring(var)
local printval = type(value) == "string" and '"'..tostring(value)..'"' or tostring(value)
self:print(spacer .. printvar .. " = " .. printval)
end
end
end
-
- Prole
- Posts: 48
- Joined: Sun Feb 01, 2009 3:32 am
Re: A console thing
I love this console library so much that I would marry it if our society's puritanical laws did not forbid it.
Re: A console thing
Is this under any license?
- qubodup
- Inner party member
- Posts: 775
- Joined: Sat Jun 21, 2008 9:21 pm
- Location: Berlin, Germany
- Contact:
Re: A console thing
did you look inside the archive?Skofo wrote:Is this under any license?
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
Re: A console thing
You have rigth. Thanks for you fix!counterfactual_jones wrote:I'm getting lots of "bad argument #1 to pairs" when I use printv. You should detect such conditions yourself and give a slightly less jarring error message than the Love error message. Like:TsT wrote:This your ConsoleTest.love modified.
Code: Select all
++ if type(inTable) != "table" then self:print("I am error!"); return end
Just another fix : (I got a error) I think the "!=" operator is "~=" in lua, isn't it ?
Code: Select all
if type(inTable) ~= "table" then
self:print("Error: This variable is not a table.")
return
end
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests