Question to Codea written in Codea

Hello,
I wanted to know how I can add own functions to the program Codea written in Codea, wich I found on the forum.
And if it would be possible to add code for classes, sprites and touch.
Thanks in advance

You can (if you are familiar with Lua) edit functions such as this example of changing the print function:

local oprint = print
function print(...)
 oprint(...)
 --Add any other code you want
end

This is as basic as changing a function gets, there’s much more complex ways to manipulate existing functions.

Thanks for your answer :slight_smile:
Can I add a function for sprites, too?
Can I use something like this:

function draw()

sprite()

end

Or how to do this?
I don’t really understand…
Thanks in advance

For codea in codea you should be able to use sprite and classes as normal is it just runs the code normally

Thanks :slight_smile:
I only have a problem with function draw()
I can’t write code then anymore.
I’ll try to fix this.
What I wanted to make was a simple program to program games, but I think this program only runs in Codeaor?
If I export it with LöveCodea, then it wouldn’t work, or?
Thanks in advance

Any idea?

In python there is a function named

exec(/string/ program)

Which runs the program written in the parameter.

Maybe Codea could have a function like that @Simeon ?

@aurumcoder2624 - Lua already does have a function that runs code, please don’t bother Simeon unnecessarily

@aurumcoder2624 loadstring(lua code string)

Oh sorry.

But u could use that for CodeaShell (CS as I have begun to call it.)

@Aurumcoder2624 I think Codeception is the word, how many levels of Codea in Codea do you go through?

Thanks for your answers :slight_smile:

If I export my project for iOS or with loveCodea for PC,
would Codea written in Codea work then or does this program only work in Codea.

I have another question, but not about Codea in Codea.
I want to write an own runtime. Does someone have an idea, what the basics for this are?

Thanks

Any idea?

About loveCodea, not all functions are supported for the moment (but you can implements them).

For your runtime, i don’t know… Do you want create another language supported by your runtime or just make it another for Lua ? (And why ?)

Thanks for your answer.
I wanted to make something like loveCodea but for a framework that supports Android and iOS. I thought something like this is called runtime. Sorry if I’m wrong.

Maybe this can be interesting : https://bitbucket.org/MartinFelis/love-android-sdl2

Thanks. :slight_smile:
Does it support gravity?
I read that it uses LÖVE 0.9.0, but I read that LoveCodea uses LÖVE 0.8.0.
I’m not sure about LoveCodea, but I thought it uses 0.8.0. I hope it works.

Yes, this is the Android port of Löve2D. With this, you can code your application entirely in Codea, and after use loveCodea script and this port for use your app directly on Android (like I can see, you have already talk about that in http://codea.io/talk/discussion/1983/app-store-games-and-apps-made-with-codea#Item_89).

I don’t know what is supported… When you look at the wiki, nothing is say about gravity support… But you can write your own wrapper module and add it in love-android-sdl2/jni/love/src/modules/. Good luck !