Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 711 712 [713] 714 715 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 890086 times)

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10680 on: January 29, 2018, 04:22:12 pm »

Well, if your string is already properly processed (which it should be), there will be no embedded escapes.

Sure, if you are joining a new path from random strings the standard library should be fine, but what if you need to do something more complicated? What if you need to parse the path and do things with it? Then you cannot just assume "\" is the windows directory separator unless you want to run into a world of pain. Hence, any path handler library needs to ignore the system separator and support "/" and "\" on Windows, or it will fail in weird ways.

Since both types of slash work, why not just default to the one that works on Linux and OSX (and many other OSes) as well? It will still be a pain to parse paths, but constructing them will be the same everywhere.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

Mesa

  • Bay Watcher
  • Call me River.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10681 on: January 29, 2018, 10:21:48 pm »

Allow me to enter full fangirl mode for a post because Godot just had its biggest release to date (3.0, after months of alphas, betas and RCs), and to me, that's hella exciting as someone who's been following the engine's development really closely for the past half a year. (And even contributed to the docs and other non-code things a bit!)
And all the work is summarized in this giant blog post.

Now I actually have an excuse to dust off my prototypes and concepts and start working on them For Real...
Their website also had a total makeover.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10682 on: January 30, 2018, 03:22:37 am »

Yeah, I've been working with their C# stuff since beta1. It's pretty nice.

McTraveller

  • Bay Watcher
  • This text isn't very personal.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10683 on: February 09, 2018, 05:38:51 pm »

Autocoding entertainment for the day (anonymized, of course):

Code: [Select]
if( (FALSE || useful_condition) && !FALSE)
{
:

Spoiler (click to show/hide)
Logged
This product contains deoxyribonucleic acid which is known to the State of California to cause cancer, reproductive harm, and other health issues.

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10684 on: February 09, 2018, 06:08:34 pm »

All I see there is a perfectly functioning if statement.

Totally unrelated, but I've heard that if you want to give your close brackets a little pizazz, you can write them as
Code: [Select]
if (thing == true)
{
    do_code();
}
else if (false)
{
    heat_up_CPU_to_fry_computer();
}

Perfectly functional, of course.  Everything is normal here.
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #10685 on: February 13, 2018, 06:11:29 am »

C++ has structured bindings now. *salivates* Soon, soon all languages will converge into a glorious functionalesque whole.
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10686 on: February 13, 2018, 01:36:36 pm »

C++ has structured bindings now. *salivates* Soon, soon all languages will converge into a glorious functionalesque whole.

Holy shit, did I miss the standard release?

... Yep, I did. And to think, I only just became used to C++11.  :P
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

Eschar

  • Bay Watcher
  • hello
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10687 on: February 16, 2018, 10:45:11 pm »

This comment is very late, but Python 3.6 added a cryptography module. In keeping with Python's irreverent naming style, it's called "secrets".
Logged

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10688 on: February 25, 2018, 06:16:37 am »

any lua coder around here? I'm confused by collectgarbage("count") - all documentation says it returns the used memory in kb, but here, it's returning two number and I don't know what is what

Code: [Select]
code:
if verbose then print("BOT",BotApi.Instance.playerId," memory sweep " , collectgarbage("count")) end

output:
[LUA] BOT 4  memory sweep  64.58984375 604
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10689 on: February 25, 2018, 08:28:11 am »

any lua coder around here? I'm confused by collectgarbage("count") - all documentation says it returns the used memory in kb, but here, it's returning two number and I don't know what is what

It shouldn't be returning two numbers. I'd be tempted to say there are some side effects somewhere.

Have you tried running collectgarbage in other contexts (like a REPL)?
Logged

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10690 on: February 25, 2018, 12:16:03 pm »

no, I've no idea what I'm doing either, I just wrote the code, it's an old interpreter deep within an old game and something it's leaking memory (but I'm pretty sure it's the game, not my code)
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10691 on: February 25, 2018, 01:29:54 pm »

Explanation: 604 divided by 1024 = 0.58984375

So, the first number is memory usage in Kbytes, and the second number is the remainder in bytes

Why it's returning that and not just the first number is a separate question. Perhaps it's specific to the old build of LUA that's embedded in that game? Maybe whoever built the game was trying to debug the memory leaks, and modified the collectgarbage routine to also return the remainder in bytes so that they had faster feedback.
« Last Edit: February 25, 2018, 01:37:00 pm by Reelya »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10692 on: February 25, 2018, 07:54:32 pm »

collectgarbage("count") in Lua 5.2 returns two values like you described. It returns one value in Lua 5.3 and Lua 5.1.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10693 on: February 25, 2018, 09:11:34 pm »

Thanks all! So turns out the leak is within the game engine, I’ve also a fairly good idea now where, maybe I’ll be able to work around it
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #10694 on: February 25, 2018, 10:37:53 pm »

I'd be surprised if it's in the game engine, unless it's allocating Lua objects itself, because collectgarbage("count") only returns the memory used by Lua objects (it has no way of detecting memory leaks from anything else).
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.
Pages: 1 ... 711 712 [713] 714 715 ... 796