This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
aaa's profile picture

Where are the native functions?

Started by aaa, 09 July 2013 - 05:22 PM
aaa #1
Posted 09 July 2013 - 07:22 PM
Hi!
I would like to know where we can find the code of the native functions, like turtle.native.blabla or term.something. Unlike most of the APIs and build in programs, those native function seem to be present before the bios. I'd be glad to be confirmed or infirmed on this point, and to be told on whether this functions are lua and where we can find them.
ElvishJerricco #2
Posted 09 July 2013 - 07:28 PM
Lots of functions aren't written in Lua. Stuff like the native turtle functions are written in Java and plugged into the system via LuaJ. When you call these native functions, the code is run via java. That's why sometimes you get weird java errors from your Lua programs. If you want to see the code for these functions, you'd have to have the source code for ComputerCraft.
aaa #3
Posted 10 July 2013 - 01:24 PM
Thanks. I should have expect that all most basic functions (at least those which interact with MC) were Java. I won't mess around Java stuff, I'll just wrap them. In fact, I'm about to write a program for remotely control (one among billions), and wanted to achieve it by overriding read and print in some tracked version. I saw that print wasn't the only display function, so I searched what is on the top. I made some unavailing test by tracking term (I loose a huge time by attempting to track it with print…), and then it wasn't enough to track the display of the main shell.
Some few times later, I discovered that it wasn't because of overriding a non basic function, but because of overriding it at a low stack.