ClassLoader - classes in CClua

Version 1.1

Update 1.1:
added stacktraces

Explanation
ClassLoader is an easy-to-use API to load programs/files as classes.
That makes communication between programs a lot easier, and it's clearer than a "all-code-in-one-file-project".

Usage
just load the api with

os.loadAPI("path/to/classloader/api")
and then you can use the following functions:
class = classloader.loadClass("path-to-class")
stacktrace = classloader.getStackTrace() --returns a table with strings, that are the function that were called.
classloader.writeStackTrace(file, append_mode) 

by calling
class("argument1", "argument2")
you run the constructor of the class.

Example class

package("test")
implement("test.otherclass") -- implementing (and class-paths) is explained later in this post.
classtype("class") -- class types are explained later in this post.

avariable = "test" -- IMPORTANT! don't use local variables, because they'll be deleted.

function testclass(arg1, arg2) -- the constructor of the class must have the same name as the class.

  print("Constructor test")
  log("test") -- everything that gets logged is saved in the .classlog dir.

  print(getpackage()) -- will print the package
  print(getclasspath()) -- will print the class path
  print(getimplement()) -- will print the class path of the class you implemented
  print(getclasstype()) -- will print your class type

  local otherclass = test.otherclass() -- calls the function "testfunction" of the "test.otherclass" class.
  otherclass.testfunction()
  testfunction() -- does the same as above, only works because we implemented "test.otherclass"

  local var = "" -- local variables inside a function are allowed
  log(type(this)) -- will log "table", the this table is a table that contents ALL variables of this class. calling this.testfunction() is the same as calling testfunction().

end

class-path
a class path is the package of a class, a dot and the class name in one string.
for example: the class path of a class with the package "testpackage" and the name "testclass" would be "testpackage.testclass")

implementing
You can implement a class with the "implement('class-path')" function. all functions of the class to implement will be copied into the own class environment.

class-types
there are 2 class-types: the "interface" class-type and the "class" class-type. If you set the class-type to "interface" by using the "classtype('interface')" function, only one instance of the class can exist. If you want to choose "class" as your class type, you don't have to call the classtype function because the default classtype is "class".

download / pastebin id
1.1: pastebin get Le0AqA5X classloader
1.0: pastebin get GpyFLf30 classloader

Bugs/Suggestions
If you find any bugs (the API is not sooo reliable) you can send me per pm or post them here or whatever you want.
Same with Suggestions.


EDIT: I made this API like a month or two ago, I just was too lazy to post it here on the forums, I don't know if someone already made something like this.

P.S.: Sorry for my bad english, hope you can read it anyway.