Event
This commit is contained in:
29
src/script/module/moduletime.h
Normal file
29
src/script/module/moduletime.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "script/scriptcontext.h"
|
||||
#include "time/time.h"
|
||||
|
||||
int moduleTimeGetDelta(lua_State *L) {
|
||||
assertNotNull(L, "Lua state cannot be NULL");
|
||||
lua_pushnumber(L, TIME.delta);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int moduleTimeGetTime(lua_State *L) {
|
||||
assertNotNull(L, "Lua state cannot be NULL");
|
||||
lua_pushnumber(L, TIME.time);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void moduleTime(scriptcontext_t *ctx) {
|
||||
assertNotNull(ctx, "Script context cannot be NULL");
|
||||
|
||||
scriptContextRegFunc(ctx, "timeGetDelta", moduleTimeGetDelta);
|
||||
scriptContextRegFunc(ctx, "timeGetTime", moduleTimeGetTime);
|
||||
}
|
||||
Reference in New Issue
Block a user