question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

creating and accessing C# objects

See original GitHub issue

Hi Florian!

I’m probably missing something, or maybe it’s not (yet) possible at all? -> I would like to create a C# object (in mages), and then access it (from mages).

what I do now: I have a plugin-function called “object” [public static object @object(Object[] args)], which I call to create/instanitante a custom C# object (it’s internally added to a dictionary of counters, so I can later refer to it again, see below…): object("counter1", "new:counter", 0, 100, 100, 5); which creates a (named) counter “counter1” with some properties

I can later use

object("counter1", "start");
object("counter1", "stop");
object("counter1", "setvalue", 15);

etc. to work with this named counter.

however, it would be great to use something like:

  counter1 = new counter(0,100,100,5);
  counter1.start();
  counter1.stop();
  counter1.value = 15;

Object metadata #49 might be what I’m looking for. It was added to milestone 2.0 - but is still open…

Thanks for any info/hints/pointers!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hanlectincommented, Sep 14, 2022

ok - thanks.

I most likely will change the delimiter for our hierarchy after all. Using “\” in the code and replacing it with a character >=0x80 root\module1\counter1.value=42 might make things clearer after all and will just require getting used to using ‘\’ instead of ‘.’

0reactions
FlorianRapplcommented, Sep 13, 2022

would most likely do the trick for me - however, wouldn’t that result in ambiguities? - like:

yes, that’s why that is no option. The only option is to make a generic string indexer as proposed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementing objects in C
In terms of C programming, an object is implemented as a set of data members packed in a struct , and a set...
Read more >
How to use c++ objects in c?
Write an interface function to convert all the class functions (constructor, destructor, member functions) as pure functions, and encapsulate ...
Read more >
How can I create and use classes and objects in C?
In C programming language, you can create classes and objects using structures and functions. Here's an example code to create a class named ......
Read more >
C++ Classes and Objects
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, ...
Read more >
Creating and Passing Objects by Value in C
This article shows the basics of working with multiple files and how to create objects without allocating them on the heap. Download source...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found