fubark / cyber

Fast and concurrent scripting.
https://cyberscript.dev
MIT License
1.16k stars 38 forks source link

date functions #51

Open GabCores opened 1 year ago

GabCores commented 1 year ago

Hi ! for working on some testings I have choose a project that need date functions

and then get values for hours , minutes and seconds May be, it is not implemented yet ? regards

fubark commented 1 year ago

I haven't looked into this but it's probably not that simple to do. I think for now this should be an external library that you import that binds to an existing C/C++ date library.

GabCores commented 1 year ago

ok, no problem , to call an endpoint will be my workaround.
By the way , how to convert a json string into a json object , for using CYON ?

fubark commented 1 year ago

There's no JSON library atm. @matu3ba was thinking of making one. You can use parseCyon to get back an object from a cyon string.

GabCores commented 1 year ago

using parseCyon would be an option , Trying to test it , i wrote

strJson = "{ name: 'John Doe'}" objJson = parseCyon(strJson) print objJson.name

but i got an error ParseError: Expected right brace. pp = "{ name: 'John Doe'}" ..........................^

What am I doing wrong ?

fubark commented 1 year ago

I'm already seeing problems with {} for string interpolation 😅. For now you can do this:

strJson = "\{ name: 'John Doe'\}"
objJson = parseCyon(strJson)
print objJson.name