mirror of
https://github.com/NeoFlock/neonucleus.git
synced 2025-09-24 09:03:32 +02:00
signals
This commit is contained in:
parent
542b4340a8
commit
4e3410e05a
@ -1,6 +1,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "neonucleus.h"
|
||||
#include "testLuaArch.h"
|
||||
|
||||
@ -8,9 +9,7 @@ void emulator_debugPrint(void *componentUserdata, void *methodUserdata, nn_compo
|
||||
nn_value msg = nn_getArgument(computer, 0);
|
||||
const char *m = nn_toCString(msg);
|
||||
printf("[DEBUG] %s\n", m);
|
||||
nn_return(computer, nn_values_cstring(m));
|
||||
nn_return(computer, nn_values_cstring(m));
|
||||
nn_return(computer, nn_values_cstring(m));
|
||||
nn_return(computer, nn_values_integer(strlen(m)));
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
@ -1,7 +1,11 @@
|
||||
print(component.doc("debugPrint", "log"))
|
||||
local a, b, c = component.invoke("debugPrint", "log", "Absolute cinema")
|
||||
print(a, b, c)
|
||||
print(component.invoke("debugPrint", "log", "Absolute cinema"))
|
||||
|
||||
computer.pushSignal("stuff", 123, "b", false, nil)
|
||||
computer.pushSignal("stuff", 123, "a", false, nil)
|
||||
computer.pushSignal("stuf2", 456, "b", true, "shit")
|
||||
computer.pushSignal("stuf3", 789, "c", false, -13)
|
||||
|
||||
print(computer.popSignal())
|
||||
print(computer.popSignal())
|
||||
print(computer.popSignal())
|
||||
print(computer.popSignal())
|
||||
|
@ -355,6 +355,10 @@ void testLuaArch_loadEnv(lua_State *L) {
|
||||
lua_setfield(L, computer, "getTemperature");
|
||||
lua_pushcfunction(L, testLuaArch_computer_addHeat);
|
||||
lua_setfield(L, computer, "addHeat");
|
||||
lua_pushcfunction(L, testLuaArch_computer_pushSignal);
|
||||
lua_setfield(L, computer, "pushSignal");
|
||||
lua_pushcfunction(L, testLuaArch_computer_popSignal);
|
||||
lua_setfield(L, computer, "popSignal");
|
||||
lua_setglobal(L, "computer");
|
||||
|
||||
lua_createtable(L, 0, 10);
|
||||
|
Loading…
x
Reference in New Issue
Block a user