Jump to content
DavidRM

Compilation Question: Format command

Recommended Posts

Why is this:

const
  RS_S_S_S_LOGGED_IN = '%s (%s, %s) logged in.';

...
Writeln(Format(RS_S_S_S_LOGGED_IN,
  [aUser.Handle, aUser.Email, aPlayer.Socket.RemoteAddress]));
...

Compiling to this:

WriteLn((aUser$1.FHandle$6.toString()+" ("+aUser$1.FEmail.toString()+", "+aPlayer$3.FSocket$1.RemoteAddress.toString()+") logged in."));

 

My thought was that by using Format() with constant strings, I would be reducing the string handling overhead.

Was my thought incorrect?

I also kinda wanted the possibility of (someday) localizing the text.

This is not a bug. Just me trying to better understand what's happening in the conversion to Javascript.

Thanks!

-David

Share this post


Link to post
Share on other sites

That's what I was missing: resourcestring

Now it compiles the way I expected:

WriteLn(Format($R[37],[aUser$1.FHandle$6, aUser$1.FEmail, aPlayer$3.FSocket$1.RemoteAddress]));

Thanks!

-David

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...